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
12963151156
from __future__ import print_function import concurrent.futures from core.colors import info def flash(function, links, thread_count): """Process the URLs and uses a threadpool to execute a function.""" # Convert links (set) to list links = list(links) threadpool = concurrent.futures.ThreadPoolExecuto...
s0md3v/Photon
core/flash.py
flash.py
py
673
python
en
code
10,128
github-code
36
3224536254
from var import * from output import * def battle_stats(): entity = V.player T.clear_text() T.print("(1) {}\n(2) {}\n(0) Back".format(V.player.name, V.mob.name), "\n", V.c_text2) select = T.input(": ") if select == "0": return if select == "1": entity = V.player if select == "2": entity = V...
ihave13digits/PythonTextRPG
ESbattle.py
ESbattle.py
py
8,987
python
en
code
4
github-code
36
70806985703
import sys sys.stdin = open('input.txt') def solution(): new_move = set() # ๋‹ค์Œ์— ์›€์ง์—ฌ์•ผ ํ•  ๊ณ ์Šด๋„์น˜, ๋ฌผ ์ขŒํ‘œ๋“ค new_water = set() for y, x in move: # ๊ณ ์Šด๋„์น˜๊ฐ€ ์ด๋™ํ•˜๋Š” ์ขŒํ‘œ for k in range(4): # ์ธ์ ‘ํ•œ ๋‹ค์Œ ์ขŒํ‘œ r = y + dr[k] c = x + d...
unho-lee/TIL
CodeTest/Python/BaekJoon/3055.py
3055.py
py
3,128
python
ko
code
0
github-code
36
4255373744
from unittest import TestCase, main from leet.merge_k_sorted_lists.main import Solution from data_structures.list_node import ListNode s = Solution() class TestSuite(TestCase): def test_1(self): list1 = ListNode(1, ListNode(4, ListNode(5))) list2 = ListNode(1, ListNode(3, ListNode(4))) lis...
blhwong/algos_py
leet/merge_k_sorted_lists/test.py
test.py
py
769
python
en
code
0
github-code
36
27433129284
import sys import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits import mplot3d import math class Interpolator: def __init__(self): DEFAULT_STEP = 1 # 10 ** 5 self.c = 0.9 # Smoothing factor self.e = 0.1 # sys.float_info.epsilon # Really small...
TimoLoomets/FSTT_dynamics
interpolator.py
interpolator.py
py
6,172
python
en
code
0
github-code
36
43679325041
import re listOfTexts = {"test test testing tester tester test test", "test test testing tester tester test test", "test test testing tester tester test test. The car"} commonWords = {} def extract(texts): for text in texts: wordList = re.sub("[^\w]", " ", text).split() for word in wo...
mhabash99/Common-Word-Extractor
commongWordExtractor.py
commongWordExtractor.py
py
697
python
en
code
0
github-code
36
28483046981
import numpy as np import cv2 import sys import argparse # Creating the parser ap = argparse.ArgumentParser() ap.add_argument("-m", "--model", required=True, help="path to the model used to make the prediction and generate the class activation maps") # Parsing the arguments args = vars(ap.parse_args()) from utilitie...
Selim78/real-time-human-detection
webcam_cam.py
webcam_cam.py
py
2,632
python
en
code
3
github-code
36
27628025167
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = ...
ArramBhaskar98/LeetCode
2021/05.May_2021/06.SLL_AVL.py
06.SLL_AVL.py
py
1,380
python
en
code
0
github-code
36
21398256786
# /usr/bin/python # -*- coding: utf-8 -*- """ This program is to: reconstruct sentences from a given data file CS137B, programming assignment #1, Spring 2015 """ import re __author__ = 'Keigh Rim' __date__ = '2/1/2015' __email__ = 'krim@brandeis.edu' if __name__ == "__main__": import argparse parser = argpa...
keighrim/bananaNER
scripts/sent_reconst.py
sent_reconst.py
py
1,087
python
en
code
1
github-code
36
1252674632
class MirrorReflection(object): def mirrorReflection(self, p, q): """ :type p: int :type q: int :rtype: int """ m, n = q, p while m % 2 == 0 and n % 2 == 0: m, n = m / 2, n / 2 if m % 2 == 0 and n % 2 == 1: retu...
lyk4411/untitled
beginPython/leetcode/MirrorReflection.py
MirrorReflection.py
py
649
python
en
code
0
github-code
36
72694740265
# ์ฃผ์œ ์†Œ import sys input = sys.stdin.readline n = int(input()) length = list(map(int, input().split())) oil = list(map(int, input().split())) min_oil = int(1e9) result = 0 for i in range(len(length)): if i == 0: min_oil = min(min_oil, oil[i]) result += (length[i] * min_oil) else: min_oil...
baejinsoo/algorithm_study
algorithm_study/BOJ/13305.py
13305.py
py
403
python
en
code
0
github-code
36
74779840744
from .hash_table_common import DEFAULT_CAPACITY_ANTILOG from Common.map import Map class _HashMapBucketNode(object): def __init__(self): self.key = None self.val = None self.next = None class HashMap(Map): """Simple hash dictionary implementation using chaining to resolve collisions....
GarfieldJiang/CLRS
P3_DataStructures/HashTable/hash_table.py
hash_table.py
py
3,389
python
en
code
0
github-code
36
37635314680
# Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters. # Example 1: # Input: s = "eceba", k = 2 # Output: 3 # Explanation: The substring is "ece" with length 3. # Example 2: # Input: s = "aa", k = 1 # Output: 2 # Explanation: The substring...
sunnyyeti/Leetcode-solutions
340 Longest Substring wit At Most K Distinct Characters.py
340 Longest Substring wit At Most K Distinct Characters.py
py
1,143
python
en
code
0
github-code
36
36289889662
import os import os.path import shutil import tarfile import hashlib import argparse import fnmatch import sys STR_EMPTY = '' STR_SLASH = '/' STR_POINT = '.' STR_TAB = '\t' STR_EOL = '\n' STR_CAT_EXT = '.cat' STR_TAR_EXT = '.tar' STR_GZ_EXT = '.tar.gz' STR_BZ2_EXT = '.tar.bz2' STR_DIR_LIST = 'DIR_LIST' STR_DIR = 'DIR...
2e8/siddar
siddar.py
siddar.py
py
34,249
python
en
code
0
github-code
36
30587275431
def gcd(a: int, b: int) -> int: assert a >= 0 and b >= 0 return gcd(b, a % b) if b != 0 else a def extended_gcd(a: int, b: int) -> tuple: assert a >= 0 and b >= 0 # compute d, x, y if b == 0: d, x, y = a, 1, 0 else: d, p, q = extended_gcd(b, a % b) x = q y = p - ...
Brian-Ckwu/discrete-mathematics
4_number_theory_and_cryptography/euclidean_algorithm.py
euclidean_algorithm.py
py
476
python
en
code
0
github-code
36
73578590183
# coding: utf-8 _all_ = [ 'processing', 'processing_outputs' ] import os import sys parent_dir = os.path.abspath(__file__ + 3 * '/..') sys.path.insert(0, parent_dir) import inclusion from inclusion.config import main from inclusion.utils import utils from inclusion.condor.job_writer import JobWriter import re impor...
bfonta/inclusion
inclusion/condor/processing.py
processing.py
py
6,926
python
en
code
0
github-code
36
24288441205
# -*- coding: utf-8 -*- """ Created on Tue Mar 15 20:50:05 2022 @author: Yifang """ import pandas as pd import matplotlib.pyplot as plt import numpy as np import traceAnalysis as Ananlysis import SPADdemod def getSignalTrace (filename, traceType='Constant',HighFreqRemoval=True,getBinTrace=False,bin_window...
MattNolanLab/SPAD_in_vivo
SPAD_Python/mainAnalysis.py
mainAnalysis.py
py
8,561
python
en
code
0
github-code
36
11399653224
""" Fits, etc. to extracted spectra """ import os import time import warnings import numpy as np import scipy.ndimage as nd from scipy.optimize import nnls import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from matplotlib.gridspec import GridSpec import astropy.io.fits as pyfits from g...
gbrammer/msaexp
msaexp/spectrum.py
spectrum.py
py
68,700
python
en
code
17
github-code
36
25107333860
from Actors.Actor import Actor from Actors.Maze import Maze from Actors.Direction import Direction from Util.Timer import Timer import pyrr import math import numpy class Pacman(Actor): # assume position is 2d vector (x cell, z cell) def __init__(self, position : list, direction : Direction, speed : float...
VolodymyrVakhniuk/Pacman
src/Actors/Pacman.py
Pacman.py
py
3,050
python
en
code
1
github-code
36
26388489404
import os import pickle import types import shutil import time import multiprocessing as mtp packageSample={"mode":"join", "from":"id123", "to":["id234", "id789"], "time":"20181012122123","type":"unknown", "tag":["dog", "white"], "dataSet":"image object"} class cellComm(object): def __init__(self): self.p...
babyproject/scripts
learn_python_commA.py
learn_python_commA.py
py
2,162
python
en
code
0
github-code
36
44648975893
#!/usr/bin/env python # coding: utf-8 from copy import deepcopy import pandas as pd import numpy as np pd.set_option("display.max_colwidth", None) def run_adult_experiments_trees_taxonomies( name_output_dir="output", type_experiment="one_at_time", type_criterion="divergence_criterion", min_support_tr...
elianap/h-divexplorer
experiments_adult_trees_taxonomies.py
experiments_adult_trees_taxonomies.py
py
7,907
python
en
code
2
github-code
36
9037585810
import tbapy import pyperclip event = input("Enter the event key: ") def getEventMatchTeams(key): tba = tbapy.TBA('KiFI9IObf1xbtTKuLzSu6clL006qHK1Lh5Xy65i1zSDutDcvsYJWwliU1svWKVzX') matches = tba.event_matches(key, simple=True) # set matches to be only keys of red and blue alliances alliances = [] ...
TotsIsTots/573_Scouting_2023
teamfinder.py
teamfinder.py
py
1,332
python
en
code
0
github-code
36
30988523805
from selenium import webdriver from selenium.webdriver.common.keys import Keys #ๅ…ณ้—ญๆ็คบๅฎ‰ๅ…จๆ็คบๆก† from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("--disable-infobars") driver = webdriver.Chrome(executable_path="/usr/bin/chromedriver",chrome_options=chrome...
lufeirider/python
crawl/selenium.py
selenium.py
py
481
python
en
code
1
github-code
36
9241363999
import csv person = {'name': 'Bob', 'age': 20, 'job': 'gardener', 'take him away!': True} # Just for example def read_file(file_name): with open(file_name, 'r', encoding='utf-8') as f: fields = ['first_name', 'last_name', 'email', 'gender', 'balance'] reader = csv.DictReader(f, fields, delimiter=...
Almazzzzz/learn_python
lesson_3/write_to_csv_file.py
write_to_csv_file.py
py
782
python
en
code
0
github-code
36
18567551028
from upwardmobility.items import UpwardMobilityItem from upwardmobility.loaders import CompanyLoader from upwardmobility.utils import * class PaDeptOfCorporationsSpider(scrapy.Spider): name = 'pa_dept_of_corporations' allowed_domains = ['file.dos.pa.gov'] start_urls = ['https://file.dos.pa.gov/search/busi...
mscandale-iabbb/research_public
upwardmobility/spiders/pa_dept_of_corporations.py
pa_dept_of_corporations.py
py
2,830
python
en
code
0
github-code
36
28519216717
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from urbansim.abstract_variables.abstract_access_within_threshold_variable import abstract_access_within_threshold_variable class employment_of_act...
psrc/urbansim
sanfrancisco/zone/employment_of_activity_id_DDD_within_DDD_minutes_SSS_travel_time.py
employment_of_activity_id_DDD_within_DDD_minutes_SSS_travel_time.py
py
1,034
python
en
code
4
github-code
36
28514815877
import os #from opus_gui.configurations.xml_configuration import XMLConfiguration from opus_gui.results_manager.run.indicator_framework.visualizer.visualization_factory import VisualizationFactory from opus_gui.results_manager.run.indicator_framework_interface import IndicatorFrameworkInterface from opus_gui.results_m...
psrc/urbansim
opus_gui/results_manager/run/opus_result_visualizer.py
opus_result_visualizer.py
py
6,698
python
en
code
4
github-code
36
17392986734
# I'm going to write a python script that creates a shell script that creates and executes a python script that prints "Hello, world" import os file_name = "hello_world.sh" with open(file_name, 'w+') as g: g.write("python -c \"print 'Hello, World!'\"") os.system("chmod 777 " + file_name) os.system("./" + file_na...
ekeilty17/Personal-Projects-In-Python
Useful/convoluted_script.py
convoluted_script.py
py
324
python
en
code
1
github-code
36
35025038372
list_item = {} #category = [] class Budget(): """A Budget class that can instantiate objects based on different budget categories like food, clothing, and entertainment. """ category = ["food", "clothing", "entertainment"] def __init__(self, category): self.category = category self....
RuthJane/budget_task
my_budget_test.py
my_budget_test.py
py
2,433
python
en
code
0
github-code
36
10899114156
#!/usr/bin/env python3 import subprocess # Compile the .dylib subprocess.run(['make'], check=True) # Convert the .dylib to a JS array literal payload = open('stage2.dylib', 'rb').read() js = 'var stage2 = new Uint8Array([' js += ','.join(map(str, payload)) js += ']);\n' with open('stage2.js', 'w') as f: f.writ...
saelo/cve-2018-4233
stage2/make.py
make.py
py
326
python
en
code
175
github-code
36
18190854190
from csv import DictReader, DictWriter from io import StringIO import functools import tempfile import os # helper to map from column names in the CSV dump to the schema dumpNameMapping = { '_id': 'mongo_id', 'admin': 'admin', 'profile.adult': 'adult', 'status.completedProfile': 'completed', 'statu...
compsoc-edinburgh/htb20-voter
app/data.py
data.py
py
3,307
python
en
code
0
github-code
36
28667648389
def printSudoku(vals): if type(vals) != str: raise TypeError("Illegal Sudoku type {}".format(type(vals))) if len(vals) != 81: raise ValueError("Illegal Sudoku length {} != 81".format(len(vals))) cry = "" for q in vals: if q not in ["1","2","3","4","5","6","7","8","9"]: cry = cry + str(...
albertiho/python2018
python/2/sudoku with exceptions.py
sudoku with exceptions.py
py
911
python
en
code
0
github-code
36
31690737543
import json import os from typing import TextIO from ctranslate2.converters.transformers import TransformersConverter def model_converter(model, model_output): converter = TransformersConverter("openai/whisper-" + model) try: converter.convert(model_output, None, "float16", False) except Exception...
ahmetoner/whisper-asr-webservice
app/faster_whisper/utils.py
utils.py
py
3,802
python
en
code
1,105
github-code
36
15171813390
# Python 3 program to # compute sum of digits in # number. # Function to get sum of digits def getSum(n): sum = 0 while (n != 0): sum = sum + int(n % 10) n = int(n/10) return sum # Driver code if __name__ == "__main__": n = 687 # Function call print(getSum(n))
amallaltlai/algorithms-python
program-for-sum-of-the-digits-of-a-given-number.py
program-for-sum-of-the-digits-of-a-given-number.py
py
280
python
en
code
0
github-code
36
74796094503
from flask import Flask, render_template, Response, jsonify, request import settings from flask import abort app = Flask(__name__, static_url_path='', static_folder='static', template_folder='templates') log = settings.logging @app.route('/') def index(): return render_templa...
jarzab3/flask_docker
cq_iot/app.py
app.py
py
1,346
python
en
code
0
github-code
36
16239759623
# list comprehension = a way to create a new list with less syntax # can mimic certain lambda functions, easier to read # list = [expression for item in iterable] squares = [] # empty list for i in range(1, 11): # for loop squares.append(i*i) # append() method adds an item to the end of the list print(squares) #...
Merlijnos/Python-Full-Course
list comprehension.py
list comprehension.py
py
476
python
en
code
0
github-code
36
7537133333
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on Jan 10, 2013 @author: daniel This utility file provides a method for moving information between Sugar instances. ''' from collections import defaultdict from sugarcrm import Sugarcrm from code import interact from sugarcrm.sugarentry import SugarEntry co...
gddc/python_webservices_library
sugarcrm/utils/S2S.py
S2S.py
py
2,952
python
en
code
46
github-code
36
7660703922
import numpy as np def loadDataSet(filename): """ๆ•ฐๆฎๅŠ ่ฝฝๅ‡ฝๆ•ฐ,ไฝ†ๅช่ฟ”ๅ›žๆ•ดไธช,ๆ— ๅ•็‹ฌ็š„label""" dataMat=[] fr=open(filename) for line in fr.readlines(): currentLine=line.strip().split("\t") fltLine=list(map(float,currentLine)) dataMat.append(fltLine) return dataMat de...
HanggeAi/machine-learing-with-numpy
ๆ ‘ๅ›žๅฝ’/regTree.py
regTree.py
py
5,983
python
zh
code
0
github-code
36
4157086617
import os import glob import imageio.v2 as imageio from wand.image import Image import PySimpleGUI as sg from moviepy.editor import ImageSequenceClip # Function to create an MP4 movie from images. def create_mp4(input_folder, output_path, fps): # Get a sorted list of image paths. image_paths = sorted...
avyaktam/ImageChef
ImageChef.py
ImageChef.py
py
7,866
python
en
code
0
github-code
36
43156184597
from VendApi import * from VendApi2 import * import CsvUtil as cu domain = '' token = '' #the product_id to search for in the inventory endpoint prod_id = '2598c236-c76c-2a64-4aee-a410a54af7d2' #################################### api = VendApi(domain, token) api2 = VendApi2(domain, token) inventories = api2.ge...
minstack/VScripts
InventoryRecordsLookup/inventory_records.py
inventory_records.py
py
1,307
python
en
code
0
github-code
36
26469668124
from ...key import Address from ...common import Int, concatBytes, _hint from ...hint import MNFT_COLLECTION_POLICY, MNFT_COLLECTION_REGISTER_FORM, MNFT_MINT_FORM, MNFT_NFT_ID, MNFT_SIGNER, MNFT_SIGNERS class CollectionRegisterForm: def __init__(self, target, symbol, name, royalty, uri, whites): assert ro...
ProtoconNet/mitum-py-util
src/mitumc/operation/nft/base.py
base.py
py
5,368
python
en
code
2
github-code
36
9495049897
### Add fixed time effects and controls for infection levels and national lockdown # Initial imports import pandas as pd import statsmodels.api as sm import numpy as np from scipy import stats import statsmodels.formula.api as smf import seaborn as sns import matplotlib.pyplot as plt import seaborn as sns #Import hou...
rg522/psych_owner
aggregate_model_4.py
aggregate_model_4.py
py
1,484
python
en
code
0
github-code
36
2152603533
import calendar import unittest from datetime import date, datetime, timedelta from codenotes import parse_args from codenotes.util.args import date_args_empty, dates_to_search class TestDateArgsNeededEmpty(unittest.TestCase): def test_no_args(self): args = parse_args(["task", "search"]) self.as...
EGAMAGZ/codenotes
tests/util/test_args.py
test_args.py
py
1,944
python
en
code
0
github-code
36
2028059224
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 24 06:56:45 2018 @author: Javier Alejandro Acevedo Barroso """ import numpy as np import matplotlib.pyplot as plt x_obs = np.array([-2.0,1.3,0.4,5.0,0.1, -4.7, 3.0, -3.5,-1.1]) y_obs = np.array([ -1.931, 2.38, 1.88, -24.22, 3.31, -21.9, ...
ClarkGuilty/2018
metodosComputacionales2/JavierAcevedo_Ejercicio6.py
JavierAcevedo_Ejercicio6.py
py
3,157
python
es
code
0
github-code
36
22869409786
# Time Complexity of Solution: # Best O(n); Average O(n^2); Worst O(n^2). # # Approach: # Insertion sort is good for collections that are very small or nearly sorted. # Otherwise it's not a good sorting algorithm: # it moves data around too much. # Each time an insertion is made, all elements in a greater position are ...
DerevenetsArtyom/pure-python
algorithms/Problem_Solving_Algorithms_Data Structures/sorting_and_search/insertion_sort.py
insertion_sort.py
py
1,194
python
en
code
0
github-code
36
28915101395
import copy from pathlib import Path from collections import defaultdict import pandas as pd import numpy as np import torch from torch.utils.data import Dataset try: import datasets as hf_datasets except ImportError: pass def get_texts_df(dir_path): paths = [x for x in dir_path.iterdir() if x.is_file()...
jeffdshen/kaggle-public
feedback/datasets.py
datasets.py
py
10,868
python
en
code
0
github-code
36
26533716957
''' Fig1. Cascade Matrix heatmap ''' import numpy as np import matplotlib.pyplot as plt # from numba import jit import matplotlib.colors as colors # @jit(nopython = True) def random_cascade_matrix(mu_L, mu_U, sigma_L, sigma_U, gamma, N = 250): J = np.zeros((N, N)) for i in range(N): for j in rang...
LylePoley/Cascade-Model
Figures/Fig1.py
Fig1.py
py
2,924
python
en
code
0
github-code
36
37712754399
from django.shortcuts import render from custom_model_field_app.forms import PersonForm # Create your views here. def customview(request): form = PersonForm() if request.method == 'POST': if form.is_valid(): form.save() return render(request,'custom.html',{'form':for...
m17pratiksha/django_models
models/custom_model_field_app/views.py
views.py
py
323
python
en
code
0
github-code
36
35401950406
def swap_case(s): count_str = len(s) modified_str = '' for i in range(count_str): if s[i].isupper(): a = s[i].lower() elif s[i].islower(): a = s[i].upper() else: a = s[i] modified_str = modified_str + a return modified_str if __name__ ...
gardayulada/HackerRankSolutions
SwapCase.py
SwapCase.py
py
396
python
en
code
0
github-code
36
35398321598
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) from pants.backend.core.tasks.check_exclusives import ExclusivesMapping from pants.backend.jvm.tasks.jvm_task import JvmTask from pants.base.exceptions import TaskErr...
fakeNetflix/square-repo-pants
tests/python/pants_test/tasks/test_jvm_task.py
test_jvm_task.py
py
1,897
python
en
code
0
github-code
36
14125615992
infile = open("input/in22_real.txt","r") # infile = open("input/in22_test.txt","r") p1 = [] next(infile) for line in infile: if line == '\n': break p1.append(int(line.strip())) p2 = [] next(infile) for line in infile: if line == '\n': break p2.append(int(line.strip())) def score(p): return sum([n*(i+1) for ...
arguhuh/AoC
2020/code22.py
code22.py
py
1,182
python
en
code
0
github-code
36
42779512033
from fastexcel import read_excel from openpyxl import load_workbook from xlrd import open_workbook def pyxl_read(test_file_path: str): wb = load_workbook(test_file_path, read_only=True, keep_links=False, data_only=True) for ws in wb: rows = ws.iter_rows() rows = ws.values for row in ro...
ToucanToco/fastexcel
python/tests/benchmarks/readers.py
readers.py
py
787
python
en
code
16
github-code
36
73122227944
# Ignas Kleveckas S2095960 import sys import time import os import select from socket import * class Sender(object): def __init__(self, remote_host, port, file_name, retry_timeout, window_size): # receive input self.remote_host = remote_host self.port = port self.file_...
ikleveckas/Reliable-data-transfer-over-UDP
Sender3.py
Sender3.py
py
4,285
python
en
code
0
github-code
36
72639783783
# https://pypi.org/project/RPi.bme280/ import smbus2 import bme280 import syslog import threading def logmsg(level, msg): syslog.syslog(level, 'station: {}: {}'.format(threading.currentThread().getName(), msg)) def logdbg(msg): logmsg(syslog.LOG_DEBUG, msg) def loginf(msg): logmsg(syslog.LOG_INFO, msg) ...
chkvch/fermentation_station
station.py
station.py
py
2,558
python
en
code
0
github-code
36
28225076046
def solution(nums: list[int]) -> int: slow, fast = 0, 0 while True: slow = nums[slow] fast = nums[nums[fast]] if slow == fast: break slow2 = 0 while slow != slow2: slow, slow2 = nums[slow], nums[slow2] return slow2 nums = [1, 3, 2, 2, 4] print(solution...
HomayoonAlimohammadi/Training
Leetcode/287_FindDuplicateNumber.py
287_FindDuplicateNumber.py
py
328
python
en
code
2
github-code
36
19542054640
import sys import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.ticker as ticker # Change default path # sys.path.append('PROGMOD_') # Function for formatting file to array of specific variables # data = txt file # sh_index = state history index, i.e. controller or environment # va...
Andreas691667/P1LeaderElection_Group2
UML & Graphs/plot.py
plot.py
py
2,036
python
en
code
0
github-code
36
40327125119
'''--------------SANKE,WATER AND GUN GAME------------------ -------------DEVELOPED BY : RANNJEET PRAJAPATI--------''''' import random def game(comp,your): if comp=='s': if your=='w': return False elif your=='g': return True elif comp=='w': if your=='...
ranjeetprajapati12/snake_water_gun_game
snake_water_gun.py
snake_water_gun.py
py
1,019
python
en
code
1
github-code
36
73885161703
from PyQt5 import QtCore from PyQt5.QtCore import QObject, QThreadPool, pyqtSignal from PyQt5.QtWidgets import QWidget, QScrollArea from cvstudio.util import GUIUtilities from cvstudio.view.widgets import ImageButton from cvstudio.view.widgets.loading_dialog import QLoadingDialog from cvstudio.view.widgets.response_gr...
haruiz/CvStudio
cvstudio/view/widgets/tab_models.py
tab_models.py
py
2,168
python
en
code
34
github-code
36
286897447
import pandas as pd import numpy as np import time import pylab as pl import math import os import pickle import gzip from operator import itemgetter from matplotlib import collections as mc import copy from random import randint from itertools import * def save_in_file_fast(arr, file_name): pickle.dump(arr, open...
shun-lin/kaggle
prime_paths/optimizing-function.py
optimizing-function.py
py
6,846
python
en
code
0
github-code
36
74853194983
from langchain.chat_models import ChatVertexAI from langchain.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain.schema import HumanMessage, SystemMessage chat = ChatVertexAI() messages = [ SystemMessage(content="You are a helpful assist...
GoogleCloudPlatform/solutions-genai-llm-workshop
LAB001-2-ChatModel/0-run.py
0-run.py
py
927
python
en
code
55
github-code
36
4124871021
import abc import numpy as np from nn.utils.label_mapper import LabelMapper from datetime import datetime class LearningAlgorithmTypes(object): SGD = "stochastic gradient descent" class LearningAlgorithmFactory(object): @staticmethod def create_learning_algorithm_from_type(learning_algorithm_type): ...
ADozois/ML_Challenge
nn/models/learning/learning_algorithms.py
learning_algorithms.py
py
4,743
python
en
code
0
github-code
36
7805060084
#!/usr/bin/env python # -*- coding:utf-8 -*- import os, sys, datetime, json from core import info_collection from conf import settings # import check python version model from plugins.detector import check_version class ArgvHandler(object): def __init__(self, argvs): self.argvs = argvs self.parse...
szlyunnan/AntOpsv2
antOpsClient/core/antMain.py
antMain.py
py
7,879
python
en
code
0
github-code
36
40761210417
class Solution(object): def uniquePaths(self, m, n): """ :type obstacleGrid: List[List[int]] :rtype: int """ memo = [[0] * (n+1) for _ in range(m+1)] return self.dfs(m , n , memo) def dfs(self, m, n, memo): # methods of postion m, n if m < 0 or n < 0: ...
QingbiaoLi/LeetCodeFighter
DP/62_UniquePath.py
62_UniquePath.py
py
1,188
python
en
code
0
github-code
36
42890165120
from pirc522 import RFID import signal import time class Rfid_Oku: def oku(): rdr = RFID() util = rdr.util() util.debug = True rdr.wait_for_tag() (error, data) = rdr.request() if not error: #print("Kart Algilandi!") (error, uid) = rd...
semohy/raspi3apps
Raspberry Pi RFID uygulamasฤฑ/Rfid_Oku.py
Rfid_Oku.py
py
562
python
en
code
0
github-code
36
34994522849
#http://www.pythonchallenge.com/pc/def/ocr.html __author__ = 'chihchieh.sun' s = ''.join([line.rstrip() for line in open('level2_ocr.txt')]) OCCURRENCES = {} for c in s: OCCURRENCES[c] = OCCURRENCES.get(c, 0) + 1 avgOC = len(s) // len(OCCURRENCES) print(''.join([c for c in s if OCCURRENCES[c] < avg...
z-Wind/Python_Challenge
level2_dictionary.py
level2_dictionary.py
py
325
python
en
code
0
github-code
36
20867944972
import numpy as np from utils import plot_output # Defining parameters N = 500 L = 5 # Topological charge number A3 = np.zeros((N, N), dtype='complex_') # Constructing SPP x = np.array([i for i in range(N)]) y = np.array([i for i in range(N)]) X, Y = np.meshgrid(x, y) theta = np.arctan2((X - N/2), (Y - N/2)) r = np....
Diana-Kapralova/Diffractive_Optics_on_Python
3.Advanced_Diffractive_Optical_Elements/3.Exersise/Ex.3.3.py
Ex.3.3.py
py
667
python
en
code
0
github-code
36
17354207696
import numpy as np from gc_utils import dictionary_to_vector from gc_utils import gradients_to_vector from gc_utils import relu from gc_utils import sigmoid from gc_utils import vector_to_dictionary from public_tests import * from testCases import * # GRADED FUNCTION: forward_propagation def forward_propagation(x, t...
HarryMWinters/ML_Coursework
Course 5, Improving Deep Neural Networks/Week 1/gradient_checking.py
gradient_checking.py
py
6,273
python
en
code
0
github-code
36
22377527144
#!/usr/bin/env python3 import nibabel as nib from nibabel import processing import numpy as np import scipy import matplotlib.pyplot as plt import matplotlib from scipy import ndimage from scipy.interpolate import RegularGridInterpolator from scipy import optimize import os, glob import json import time import shutil ...
erikglee/OSPREY_Containerization
code/localizer_alignment.py
localizer_alignment.py
py
21,949
python
en
code
0
github-code
36
70190181225
""" "Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort." """ import random import time lista_rand = random.sample(range(1, 860), 10) print(list...
mabittar/desafios_pythonicos
ordenacao/insertion_sortR2.py
insertion_sortR2.py
py
1,079
python
en
code
0
github-code
36
15982937093
import numpy as np from matplotlib.pyplot import * from scipy import interpolate dat=np.loadtxt("/home/davidvartanyan/presupernova.dat") rad=dat[:,2] rho1=dat[:,4] i=0 while rad[i]/10**9 < 1: i+=1 xlim([rad[0],rad[i]]) #loglog(rad[0:i],rho1[0:i],'k') npoints=1000 radmin=rad[0] radmax=10**9 radius=np.linspace(0.1, ...
dvartany/ay190
ws12/ws12.py
ws12.py
py
2,041
python
en
code
0
github-code
36
43429268023
def main(): N = int(input()) S = input() max = 0; for i in range(1, N): l = S[:i] r = S[i:] used = [] for k in l: if k in r and k not in used: used.append(k) if len(used) > max: max = len(used) print(max) if __name__ == '__main__':...
oamam/atcoder_amama
python/beginner/20180526/B.py
B.py
py
329
python
en
code
0
github-code
36
43506783122
#!/usr/bin/env python3 """This modual holds the class created for task 3""" import numpy as np import matplotlib.pyplot as plt class Neuron: """ Neuron - class for a neuron nx = the number of input freatures to the neuron """ def __init__(self, nx): if not isinstance(nx, int): ...
chriswill88/holbertonschool-machine_learning
supervised_learning/0x00-binary_classification/7-neuron.py
7-neuron.py
py
3,565
python
en
code
0
github-code
36
7707679326
import os import sys import time import copy import random from reprint import output MAX_oo = 65535 MIN_MAX = 65280 MIN_oo = -65535 ''' print("1111111",end="") print("\r222222",end="") โ•ณใ€‡ โ”€โ”โ”‚โ”ƒโ”„โ”…โ”†โ”‡โ”ˆโ”‰โ”Šโ”‹โ”Œโ”โ”Žโ”โ”โ”‘โ”’โ”“โ””โ”•โ”–โ”—โ”˜โ”™โ”šโ”› โ”œโ”โ”žโ”Ÿโ” โ”กโ”ขโ”ฃโ”คโ”ฅโ”ฆโ”งโ”จโ”ฉโ”ชโ”ซโ”ฌโ”ญโ”ฎโ”ฏโ”ฐโ”ฑโ”ฒโ”ณโ”ดโ”ตโ”ถโ”ทโ”ธโ”นโ”บโ”ป โ”ผโ”ฝโ”พโ”ฟโ•€โ•โ•‚โ•ƒโ•„โ•…โ•†โ•‡โ•ˆโ•‰โ•Šโ•‹ โ•โ•‘โ•’โ•“โ•”โ••โ•–โ•—รจ]โ•šโ•›โ•œโ•โ•žโ•Ÿโ• โ•กโ•ขโ•ฃโ•คโ•ฅโ•ฆโ•งโ•จโ•ฉโ•ชโ•ซโ•ฌโ•ณ โ•” โ•—โ•โ•š โ•ฌ โ• โ•“ โ•ฉ โ”  โ”จ...
Mecheal-helloworld/Python-shell
demo/MIN_MAX.py
MIN_MAX.py
py
4,714
python
en
code
0
github-code
36
8868610859
import logging from aiogram import Dispatcher, types from aiogram.dispatcher import FSMContext import aiogram.utils.markdown as fmt from aiogram.types.message import ContentType from .. import userchoice def check_none_name(name): new_name = '' if name is not None: new_name = name return new_nam...
KFeyn/naming_bot
app/handlers/common.py
common.py
py
2,897
python
ru
code
0
github-code
36
37840139507
import logging from django.utils.translation import ugettext_lazy as _ from mayan.apps.acls.classes import ModelPermission from mayan.apps.common.apps import MayanAppConfig from mayan.apps.common.menus import ( menu_object, menu_return, menu_secondary, menu_setup ) from mayan.apps.events.classes import EventModel...
salmabader/mayan-edms
mayan/apps/credentials/apps.py
apps.py
py
3,033
python
en
code
0
github-code
36
37821183076
import tensorflow as tf import numpy as np from tensorflow.python.ops.signal import window_ops from scipy import stats import decimal, math import os, sys import librosa import soundfile as sf import functools import matplotlib.pyplot as plt from matplotlib import style from scipy.special import exp1 import math class...
golfbears/DeepXi
bak/multiphase.py
multiphase.py
py
18,079
python
en
code
null
github-code
36
17585811312
import struct import typing as t from pathlib import Path from starwhale import Link, GrayscaleImage _TItem = t.Generator[t.Dict[str, t.Any], None, None] def iter_mnist_item() -> _TItem: root_dir = Path(__file__).parent.parent / "data" with (root_dir / "t10k-images-idx3-ubyte").open("rb") as data_file, ( ...
star-whale/starwhale
example/mnist/mnist/dataset.py
dataset.py
py
2,105
python
en
code
171
github-code
36
650843683
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from pymongo import MongoClient class AqdyPipeline(object): def process_item(self, item, spider): xfplay_link = {...
jihongzhu/python-
aqdy/aqdy/pipelines.py
pipelines.py
py
887
python
en
code
0
github-code
36
4104421635
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 23 11:27:48 2018 @author: anup """ from elasticsearch import Elasticsearch from bs4 import BeautifulSoup as BS import glob from preprocess_class import EsPreProcessor import warnings from html_processing import * warnings.filterwarnings('ignore') ...
anupkhalam/es_xd_standalone
html_indexer.py
html_indexer.py
py
2,752
python
en
code
0
github-code
36
31068607886
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 15:00 # @Author : cold # @File : python_mysql.py from configparser import ConfigParser import os class MySQLConfig(ConfigParser): def __init__(self, config, **kwargs): # ConfigParser.__init__(self,allow_no_value=True) super(MySQLConfig, s...
liangtaos/mysqlmanage
python_mysql.py
python_mysql.py
py
1,876
python
en
code
0
github-code
36
1511337021
import pandas as pd import datetime def load_analysis(analysis_id, data, metadata_record, projects, es, framework): load_data(data, analysis_id, es, framework) if framework == 'scp': metadata_record['cell_count'] = data['annotation_metrics'].shape[0] elif framework == 'mondrian': metadata...
shahcompbio/alhenaloader
alhenaloader/load.py
load.py
py
3,730
python
en
code
0
github-code
36
26868051842
"""A perfect power is a classification of positive integers: In mathematics, a perfect power is a positive integer that can be expressed as an integer power of another positive integer. More formally, n is a perfect power if there exist natural numbers m > 1, and k > 1 such that mk = n. Your task is to check wheter a ...
DavorKandic/from_codewars
perfect_power.py
perfect_power.py
py
1,898
python
en
code
0
github-code
36
10180408027
#!/usr/bin/python3 ''' Core Flask App ''' from flask import Flask, jsonify, make_response from models import storage from api.v1.views import app_views from os import getenv app = Flask(__name__) app.register_blueprint(app_views) app.url_map.strict_slashes = False @app.teardown_appcontext def closeStorage(ob): '...
jamesAlhassan/AirBnB_clone_v3
api/v1/app.py
app.py
py
746
python
en
code
0
github-code
36
16185556027
import string import sqlalchemy.sql as sasql from ..util import random_string, sha256_hash from ..adapter.repository import UserRepo, UserFollowRepo from .exception import UsecaseException, NotFoundException class UserUsecase: _mobile_verify_codes = {} _email_verify_codes = {} def __init__(self, config...
jaggerwang/sanic-in-practice
weiguan/usecase/user.py
user.py
py
5,796
python
en
code
42
github-code
36
28775606066
#!/usr/bin/env python3.7 # Soubor: view.py # Datum: 25.03.2019 13:11 # Autor: Marek Noลพka, nozka <@t> spseol <d.t> cz # Licence: GNU/GPL ############################################################################ from . import app, socketio from flask import (render_template, # Markup, ...
MarrekNozka/socketio-experiment
webface/routes.py
routes.py
py
1,116
python
de
code
0
github-code
36
40806340636
""" Problem 30: Digit fifth powers https://projecteuler.net/problem=30 Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 1^4 + 6^4 + 3^4 + 4^4 8208 = 8^4 + 2^4 + 0^4 + 8^4 9474 = 9^4 + 4^4 + 7^4 + 4^4 As 1 = 1^4 is not a sum it is not included. The sum ...
FranzDiebold/project-euler-solutions
test/test_p030_digit_fifth_powers.py
test_p030_digit_fifth_powers.py
py
1,404
python
en
code
1
github-code
36
70863160103
import json from datetime import datetime from dataclasses import dataclass from tabulate import tabulate import requests from exceptions import WrongCommandFormat from tools import \ format_task, \ http_response_to_str, \ FORMATTED_TASK_COLUMNS from config import URL, HELP_MSG @dataclass class Handle...
yabifurkator/appvelox_task
client/handlers.py
handlers.py
py
3,325
python
en
code
0
github-code
36
28757254981
import psycopg2 import psycopg2.pool from psycopg2.extras import execute_values import pandas.io.sql as psql class Dbconnection: def __init__(self, schema, database, user, password, dbhost, dbport): self._properties = dict( database=database, user=user, password=passwo...
csipiemonte/unlockpa-unlockbotrasa
code_actions/db/dbconnection.py
dbconnection.py
py
3,262
python
en
code
0
github-code
36
15983286793
import re def calcularBinario(exp, n): ''' Funciรณn recursiva. Recibe un nรบmero (1 o 0) y su รญndice en la cadena introducida por el usuario. Con estos 2 valores se calcularรก la operaciรณn correspondiente a: nรบmero (n) * 2 elevado al indice (exp) Params: 111001 n (int) = v...
dvd23m/RetosMoureDev
Reto38_BinarioaDecimal/BinarioToDecimal.py
BinarioToDecimal.py
py
1,198
python
es
code
2
github-code
36
6200752155
from __future__ import print_function import torch.nn as nn from torch.nn.utils.weight_norm import weight_norm from utils import plot_variance class FCNet(nn.Module): """Simple class for non-linear fully connect network""" def __init__( self, dims, activation=nn.ReLU, relu_init=False, var_analysis=Fa...
cliziam/VQA_project_Demo
demo-vqa-webcam/fc.py
fc.py
py
1,847
python
en
code
0
github-code
36
16539479262
import json from common.variables import * def send_msg(socket, msg): json_msg = json.dumps(msg) coding_msg = json_msg.encode(ENCODING) socket.send(coding_msg) def get_msg(client): json_response = client.recv(MAX_PACKAGE_LENGTH).decode(ENCODING) response = json.loads(json_response) if isinst...
MariaAfanaseva/app
HW_3_Afanaseva_Maria/common/utils.py
utils.py
py
401
python
en
code
0
github-code
36
5234638589
import tkinter.ttk as ttk from tkinter import * import time root = Tk() root.title("Hoon GUI") root.geometry("640x480") # ๊ฐ€๋กœ * ์„ธ๋กœ + X์ขŒํ‘œ + Y์ขŒํ‘œ # progressbar = ttk.Progressbar(root, maximum = 100, mode="indeterminate") # mode: indeterminate(์–ธ์ œ ๋๋‚ ์ง€ ๋ชจ๋ฅด๋Š” ๊ฒฝ์šฐ) # progressbar = ttk.Progressbar(root, maximum = 100, mo...
OctoHoon/PythonStudy_GUI
gui_basic/9_progressbar.py
9_progressbar.py
py
1,077
python
ko
code
0
github-code
36
28320633011
import os import platform import subprocess import sys def create_virtualenv(): '''Determine the appropriate virtual environment command based on the platform''' if platform.system() == "Windows": venv_cmd = "python -m venv .venv" else: venv_cmd = "python -m venv .venv" # Run the virtu...
ImredeAngelo/delta
scripts/init.py
init.py
py
1,219
python
en
code
0
github-code
36
73881855145
from nlp_flask_client import NLPClient import pandas as pd csv_filename = "messaging_data.csv" data_df = pd.read_csv(csv_filename) IP = "127.0.0.1" # Local PORT = 5000 # Always running multi_threaded=True multi_messages=True threads_no=20 rows_per_call = 13 client = NLPClient(IP, PORT) # Testing with a single stri...
Gabryxx7/nlp-flask-server
analyse_data.py
analyse_data.py
py
1,322
python
en
code
2
github-code
36
2938524596
import sys input=sys.stdin.readline class SegmentTree: def __init__(self,arr): self.n=len(arr) self.tree=[0] * (4*self.n) #? self.lazy=[0] * (4*self.n) self.build(1,0,self.n-1,arr) def build(self,node,left,right,arr): if(left==right): self.tree[node]=arr...
DoSeungJae/Baekjoon
Python/2268.py
2268.py
py
1,649
python
en
code
1
github-code
36
18370027108
from flask import Flask, request, render_template import json import pickle import nltk import string import re #from nltk.classify import NaiveBayesClassifier app = Flask(__name__) #preprocess the text def preprocess(sentence): nltk.download('stopwords') nltk.download('punkt') def build_bow_features(wor...
AnasE17/SentimentAnalysis
app.py
app.py
py
1,434
python
en
code
0
github-code
36
952895712
pkgname = "libpeas" pkgver = "1.36.0" pkgrel = 2 build_style = "meson" configure_args = ["-Ddemos=false", "-Dvapi=true"] make_check_wrapper = ["weston-headless-run"] hostmakedepends = [ "meson", "pkgconf", "glib-devel", "gettext", "vala", "gobject-introspection", "python", ] makedepends = [ ...
chimera-linux/cports
main/libpeas/template.py
template.py
py
960
python
en
code
119
github-code
36
39006060669
""" ๋ฌธ์ œ์œ ํ˜•: ์ด๋ถ„ ํƒ์ƒ‰ ๋ฌธ์ œ: https://www.acmicpc.net/problem/2417 ํ’€์ด ์ด๋ถ„ ํƒ์ƒ‰์œผ๋กœ ์ œ๊ณฑ๊ทผ ๊ตฌํ•˜๋Š” ๋ฌธ์ œ๋กœ ์ด๋ถ„ ํƒฌ์ƒ‰์— ๋Œ€ํ•ด ์ดํ•ด๊ฐ€ ์žˆ์–ด์•ผ ํ’€์ˆ˜ ์žˆ์Œ 1.์ด๋ถ„ํƒ์ƒ‰ start 0, end ์ž…๋ ฅ๋ฐ›์€ ์ˆ˜ ์„ค์ • 2.๋ฐ˜๋ณต ์กฐ๊ฑด์œผ๋กœ ์‹œ์ž‘์‹œ์ ์ด ์ข…๋ฃŒ์‹œ์ ๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์„๋•Œ๊นŒ์ง€ ์ˆ˜ํ–‰(์ด์กฐ๊ฑด ์ค‘์š”!) 3.์ค‘๊ฐ„๊ฐ’์˜ ์ œ๊ณฑ์ด ์ž‘์œผ๋ฉด start์— ์ค‘๊ฐ„๊ฐ’ + 1 ์ฒ˜๋ฆฌ ์•„๋‹๊ฒฝ์šฐ end์— ์ค‘๊ฐ„๊ฐ’ -1 4.๋งˆ์ง€๋ง‰ start๊ฐ€ end๋ฅผ ๋„˜์–ด๊ฐˆ๋•Œ์˜ ๊ฐ’์ด ๊ฒฐ๊ณผ๊ฐ’ keypoint: ๊ฐ€์žฅ ์ž‘์€ ์ •์ˆ˜๋ฅผ ๊ตฌํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ œ๊ณฑ๊ทผ์— ์ˆ˜์— ๊ธฐ์ค€์ด...
daeyoungshinme/algorithm
๋ฐฑ์ค€/์ด์ง„ํƒ์ƒ‰/boj2417.py
boj2417.py
py
852
python
ko
code
0
github-code
36
26852296512
from draw_rectangle import print_bbox def get_tokens(txt:str): if txt == "nan" or len(txt.strip()) == 0: return [] else: return txt.split() import Levenshtein def calculate_distance(data,findtxt): if type(data) == str and type(findtxt) == str and len(findtxt) > 0: return Levenshtein.distance(dat...
helderarr/patents_dataset
main.py
main.py
py
6,975
python
en
code
0
github-code
36
43168841119
import settings import os import click import inspect import sys from configure import db as dbs from apps import app from CustomerException import ParameterError from apps.API.models import ( Model, Device, DeviceService, DeviceServiceData ) from asyncpg import create_pool from utils.tab...
DemonXD/template_sanic_project
manager.py
manager.py
py
2,643
python
en
code
1
github-code
36