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
27199421294
from selenium.common.exceptions import NoSuchElementException, ElementClickInterceptedException from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.su...
Johanlai/ds_salary_project
glassdoor_scraper.py
glassdoor_scraper.py
py
8,794
python
en
code
0
github-code
1
2598497133
from typing import Any, List, Optional import discord from discord.components import SelectOption from discord.ext import commands import logging import logging.handlers from discord.interactions import Interaction from discord.utils import MISSING logger = logging.getLogger('discord') logger.setLevel(logging.INFO) h...
Tobydog0501/XiaoYueDCBot
core/core.py
core.py
py
2,071
python
en
code
0
github-code
1
24278186293
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = "Caio Carrara" AUTHOR_EMAIL = "eu@caiocarrara.com.br" SITENAME = "cC Log" SITEURL = "http://localhost:8000" TAGLINE = "Caio Carrara, Programação, Python, Software, Liberdade e Autonomia" PATH = "content" TIMEZONE = "Ame...
caiocarrara/cclogging
pelicanconf.py
pelicanconf.py
py
1,479
python
en
code
0
github-code
1
37086718038
# -*- 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 import sqlite3 from contextlib import closing import scrapy import json class MsbrPipeline(object): def open_spider(self...
kmkirov/msbr
msbr/msbr/pipelines.py
pipelines.py
py
1,641
python
en
code
0
github-code
1
39510862648
import sys input = sys.stdin.readline N = int(input()) # sys.maxsize 사용할 경우 python 에서 낼 수 있는 최대값을 불러올 수 있다고 한다. min_value = sys.maxsize max_value = -sys.maxsize # 모든 값들을 더해줄 변수 total = 0 # 들어온 숫자 딕셔너리로 몇개 들어왔는지 카운트 num_dict = {} # 들어온 숫자들 리스트 check_list = [] # 최빈값 구하기 위한 리스트 num_list = [] for _ in range(N): num...
choikeunyoung/algorithm
백준/Silver 3/2108.py
2108.py
py
2,447
python
ko
code
1
github-code
1
25467629055
__author__ = 'rafek@google.com (Rafe Kaplan)' import appengine_config from protorpc.webapp import service_handlers import tunes_db def main(): service_handlers.run_services( [('/music', tunes_db.MusicLibraryService), ]) if __name__ == '__main__': main()
hanpfei/chromium-net
third_party/catapult/third_party/gsutil/third_party/protorpc/demos/tunes_db/server/services.py
services.py
py
273
python
en
code
289
github-code
1
70000416355
import cv2 as cv from yolov7.utils.plots import plot_one_box import torch import numpy as np from pathlib import Path def plot_boxes(bboxes, img, color=None, labels=None, line_thickness=2): if type(bboxes) == torch.Tensor: bboxes = bboxes.cpu().numpy() if labels is None: for bbox in bboxes: ...
Sean053047/Smog-Car-Detection
lib/utils/video_inference.py
video_inference.py
py
2,312
python
en
code
0
github-code
1
37919249005
from collections import namedtuple from nightwatch import c_dsl from nightwatch.parser import parse_requires default_annotations = dict( depends_on=set(), object_depends_on=set(), object_record=False, object_explicit_state_replace=c_dsl.Expr("NULL"), object_explicit_state_extract=c_dsl.Expr("NULL"...
utcs-scea/DGSF-AvA
cava/nightwatch/annotation_set.py
annotation_set.py
py
4,709
python
en
code
1
github-code
1
25615912618
# from django.shortcuts import render from django.contrib.auth.models import User from room import models import requests from rest_framework import status from rest_framework.utils import json from rest_framework.views import APIView from rest_framework.response import Response # from rest_framework_simplejwt.tokens ...
LinYi-Taiwan/borrow_sys_backend
room/views.py
views.py
py
6,101
python
en
code
0
github-code
1
32365101016
class Pupil: lastName = '' score = 0 def sortByScore(c): return (c.score) n = int(input()) l = [] for i in range(n): temp = input().split() q = Pupil() q.lastName = temp[0] q.score = int(temp[1]) l.append(q) l.sort(key=sortByScore, reverse=True) for item in l: print(item.lastName...
GNicoDev/My_Python_programs
Courcera/Основы программирования на Python/Неделя 6/12_OlympiadResults.py
12_OlympiadResults.py
py
322
python
en
code
1
github-code
1
28393657639
import numpy as np import cv2 import json import os.path as osp import xml.etree.ElementTree as ET import copy import datetime from collections import defaultdict from coco_annotation import CocoAnnotationClass def recursively_get_all_subchild_ids(e_id, element_ids_dict): if e_id not in element_ids_dict: return ...
mrlooi/labelme_scripts
labelme_to_coco.py
labelme_to_coco.py
py
4,494
python
en
code
1
github-code
1
19103804423
import os import unittest import numpy as np import pydrake from pydrake.attic.multibody import shapes from pydrake.common.eigen_geometry import Isometry3 class TestShapes(unittest.TestCase): def test_api(self): box_size = [1., 2., 3.] radius = 0.1 length = 0.2 box = shapes.Box(...
GTLIDAR/safe-nav-locomotion
motion_planner/drake/bindings/pydrake/attic/multibody/test/shapes_test.py
shapes_test.py
py
2,312
python
en
code
21
github-code
1
40390256101
fname = input("Enter a file name: ") try: handle = open(fname) except: print("Invalid file name.") quit() domains = dict() for line in handle: if not line.startswith("From "): continue words = line.split() domain = words[1].split("@") domains[domain[1]] = domains.get(domain[1], 0) ...
Raphaelmt/py4e
ex_09_05.py
ex_09_05.py
py
341
python
en
code
0
github-code
1
32200663906
from tkinter import * import pygame as py import os window = Tk() window.title("Ton Player") window.geometry("650x260") window.config(bg="black") py.init() playstate = 0 mainb = PhotoImage(file="Icons/play.png") pauseimage = PhotoImage(file="Icons/stop.png") playimage = PhotoImage(file="Icons/play.png") def playsto...
capsaicin01/Mp3-Player
main.py
main.py
py
2,442
python
en
code
0
github-code
1
33876079295
#Purpose: Decode a steganographically coded image #Author: Dewar P. from PIL import Image def hidden_num(pixel): r,g,b = pixel lsdr = r%10 *100 lsdg = g%10 *10 lsdb = b%10 *1 return(lsdr+lsdg+lsdb) def hidden_char(X): return(chr(X)) def decode(original_pic, N): pic...
pdewar/Python
Steganography/stegdecode.py
stegdecode.py
py
1,411
python
en
code
0
github-code
1
11324927158
# This example requires the 'members' privileged intent to use the Member converter. # This example also requires the 'message_content' privileged intent to function. import traceback import typing import discord from discord.ext import commands intents = discord.Intents.default() intents.members = True intents.mess...
Rapptz/discord.py
examples/converters.py
converters.py
py
5,355
python
en
code
13,719
github-code
1
69860707874
import tkinter as tk from tkinter import filedialog from tkinter.ttk import Combobox import pyperclip from summarizetext import Summarizer from languagedropdown import dropdown # Create an instance of the Summarizer class summarizer = Summarizer() # Function to browse for a file def browse_file(): filename = file...
tokyographer/text-summarizer-python
text_summarizer_gui.py
text_summarizer_gui.py
py
3,008
python
en
code
0
github-code
1
6918515986
from django.urls import path from . import views app_name = 'math_chart' urlpatterns = [ path('', views.home, name='home'), path('my_chart_10/', views.my_chart_10, name='my_chart_10'), path('my_chart_20/', views.my_chart_20, name='my_chart_20'), path('b6_b6', views.b6_b6, name='b6_b6'), path('my_sq...
DispersionemScientia/Math_Charts
math_chart/urls.py
urls.py
py
579
python
en
code
0
github-code
1
41407487592
# 212. Word Search II # https://leetcode.com/problems/word-search-ii/ # https://leetcode.com/problems/word-search-ii/discuss/59780/Java-15ms-Easiest-Solution-(100.00) # https://leetcode.com/problems/word-search-ii/discuss/59790/Python-dfs-solution-(directly-use-Trie-implemented). class TrieNode: def __init__(se...
aszx4510/LeetCode
python/0212-word_search_ii.py
0212-word_search_ii.py
py
1,576
python
en
code
0
github-code
1
9350440170
# -*- coding: utf-8 -*- """ Programme utilsant la version 2.7 de Python Solution au pydefis : https://callicode.fr/pydefis/BoitesSucres/txt Dans ce programme on donne la liste des nombres de sucres qui imposent une taille de boite unique 252 sucres disposés en 4 couches de 7x9 sucres. 7x9x4 contenant 3 couches d...
nikokks/Answers-Of-Python-Programming-Challenges
Le probleme des boites a sucres/Le problème des boîtes à sucres.py
Le problème des boîtes à sucres.py
py
1,483
python
fr
code
0
github-code
1
13211216847
xp = 100 # start money p = 5 # [%] interest rate N = 4 # [years] int_counter = 0 # counter for while loop outfile = open('growth.dat','w') # saving new file growth.dat outfile.write('Interest rate = %.2f percent\n' % p) # file heading outfile.write('year ...
simehaa/University
inf1100/growth_years_efficient.py
growth_years_efficient.py
py
612
python
en
code
0
github-code
1
5928162899
import torch import torch.nn.functional as F class Act(torch.nn.Module): def __init__(self, act: str, slope: float = 0.05) -> None: super(Act, self).__init__() self.act = act self.slope = slope self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, input: torch.Ten...
Open-Catalyst-Project/ocp
ocpmodels/models/utils/activations.py
activations.py
py
1,471
python
en
code
518
github-code
1
74474929633
# Test script for 3-ch RPi Relay Board import RPi.GPIO as GPIO from time import sleep # Relay channel definitions relay1 = 26 relay2 = 20 relay3 = 21 # Initialise GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(relay1,GPIO.OUT) GPIO.setup(relay2,GPIO.OUT) GPIO.setup(relay3,GPIO.OUT) # Relays are active-low GPIO.output(relay1,T...
graham-mitchell-vcs/scripts
relayTest.py
relayTest.py
py
548
python
en
code
0
github-code
1
11560175645
# Importing libraries import RPi.IO as IO import time # NOTEs: # IO.LOW = Zero = False # IO.HIGH = Non-Zero Value = True # Garbage Collector IO.cleanup() # Setting pins numbering mode (BCM or BOARD) IO.setmode(IO.BOARD) # Global Data ledPin = 12 ldrPin = 11 morningState = False # Configuring pins IO.setup(ledPin, ...
makaram99/embedded-linux
projects/03_ldr_and_led.py
03_ldr_and_led.py
py
725
python
en
code
0
github-code
1
12009131168
## Import Packages import pandas as pd #importing all the important packages import numpy as np import matplotlib.pyplot as plt import seaborn as sns import json from ast import literal_eval ## Define dataset df = pd.read_csv('movies_metadata.csv', encoding = 'UTF-8', low_memory=False) df2 = pd.read_csv('c...
yashkp1234/Movie-Recommendation-Engine
Python Scripts/Actor Analysis.py
Actor Analysis.py
py
2,799
python
en
code
0
github-code
1
25623285728
import tensorflow as tf from tensorflow.keras import datasets, layers, models import matplotlib.pyplot as plt (train_images, train_labels), (test_images, test_labels) = datasets.cifar10.load_data() # Normalize pixel values to be between 0 and 1, like we did in testproj 6 train_images, test_images = train_i...
Ihsan101/tensorflow-test-projects
Convolutional Neural Network Models/testproj 7- CNN Model, Image Class.py
testproj 7- CNN Model, Image Class.py
py
3,651
python
en
code
0
github-code
1
313912497
import sys if sys.version_info[0] == 3: from builtins import str import json from ._loader import ClassLoader from ._codec_utils import parseMoClassName, getParentDn, listWithTotalCount def parseJSONError(rspText, errorClass, httpCode=None): try: rspDict = json.loads(rspText) data = rspDict.g...
datacenter/cobra
cobra/mit/jsoncodec.py
jsoncodec.py
py
3,897
python
en
code
89
github-code
1
36076367490
import re from difflib import ndiff import smtplib from datetime import date, datetime from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email import encoders import os import io import re import time import openpyxl import asyncio...
bairisachin/PIC-Data-Audit-Tool
Scraper.py
Scraper.py
py
73,539
python
en
code
0
github-code
1
41746279645
import pandas as pd import numpy as np df = pd.read_csv('WA_Fn-UseC_-Telco-Customer-Churn.csv') df.head() # Convert categorical variables into numerical variables from sklearn.preprocessing import LabelEncoder, StandardScaler categorical_features = ['gender', 'Partner', 'Dependents', 'PhoneService', 'MultipleLines', ...
aniketwdubey/Customer-Churn-Prediction
churn.py
churn.py
py
3,769
python
en
code
1
github-code
1
25207102553
import sys as System; if(len(System.argv) > 1): #get file File = open(System.argv[1], 'r') FileOut = open("no_com_" + System.argv[1], 'w') output = "" foundMultiLine = False for line in File: Line = line.split("\r")[0].split("\n")[0] print(Line) foundMultiLineLine=1 ...
JCollins0/BashScripts
nocomment.py
nocomment.py
py
1,350
python
en
code
0
github-code
1
14339755416
from django.contrib.auth import get_user_model from django.test import Client, TestCase from django.urls import reverse from posts.models import Group, Post User = get_user_model() class PostPagesTests(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.user = User.objects...
alexandr-shinko96/hw04_tests
yatube/posts/tests/test_views.py
test_views.py
py
3,719
python
ru
code
0
github-code
1
4451022121
from qdrant_client import models, QdrantClient import numpy as np import torch import pandas as pd from sentence_transformers import SentenceTransformer from transformers import ViTImageProcessor, ViTModel import cv2 import numpy as np import time import os qdrant = QdrantClient(":memory:") def upload_qdrant(embeddin...
MuhammadBilal848/Vector-DB-Qdrant
qdrant_module for image.py
qdrant_module for image.py
py
2,088
python
en
code
1
github-code
1
5059451700
from __future__ import annotations from vstools import core, vs __all__ = [ 'telecine_patterns', ] def telecine_patterns(clipa: vs.VideoNode, clipb: vs.VideoNode, length: int = 5) -> list[vs.VideoNode]: a_select = [clipa.std.SelectEvery(length, i) for i in range(length)] b_select = [clipb.std.SelectEver...
jiaolovekt/HPCENC
deps/vs-plugins/vsdeinterlace/utils.py
utils.py
py
514
python
en
code
11
github-code
1
1586067119
"""Tests for ``highcharts.no_data``.""" import pytest from json.decoder import JSONDecodeError from highcharts_core.global_options.language import Language as cls from highcharts_core import errors from tests.fixtures import input_files, check_input_file, to_camelCase, to_js_dict, \ Class__init__, Class__to_untr...
highcharts-for-python/highcharts-core
tests/global_options/language/test_language.py
test_language.py
py
3,946
python
en
code
40
github-code
1
4225885261
from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import numpy as np import random import json from otree.models import subsession author = 'Cesar Mantilla & Ferley Rincon' doc = """ Adult children gender an...
ferleyrincon/transfers
home/models.py
models.py
py
4,301
python
en
code
0
github-code
1
18023591978
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch import optim import warnings from .training import WGAN def make_GANbalancer(dataset, generator_input, generator_layers, critic_layers, emb_sizes, no_aux,learning_rate,critic_iteration...
johaupt/GANbalanced
DEPRECATED/wgan/models_cat.py
models_cat.py
py
9,506
python
en
code
14
github-code
1
133399967
import numpy as np import random import matplotlib.pyplot as plt from matplotlib import animation ################################ # 修改这个alpha玩!其他代码不需要动! # 这个示意的例子跟真实ML不一样,alpha通常在0.001到0.1之间 alpha = 0.9 ################################ x = np.arange(-5,5,0.1) y = x**2 fig, ax = plt.subplots() ax.grid() ax.plot(x,...
zxupstar/TensorFlow-Tools
Learn_rating.py
Learn_rating.py
py
1,356
python
en
code
1
github-code
1
18080046914
#Daniel Ferreira def absoluto(n:int) -> int: """Essa função verifica primeiramente se o número é positivo. Caso não seja, converte ele para positivo e o retorna. Se a pessoa não escrever um núemro, aparecerá um TypeError e um ValueError, informando o erro.""" try: if n < 0: n * -1 ...
Danib0y97/Comp2_listas
lab5.py/lab5.py
lab5.py
py
1,568
python
pt
code
0
github-code
1
35915478681
# Python > Sets > Set .union() Operation # Use the .union() operator to determine the number of students. # # https://www.hackerrank.com/challenges/py-set-union/problem # n = int(input()) english = set(map(int, input().split())) n = int(input()) french = set(map(int, input().split())) print(len(english | french))
rene-d/hackerrank
python/py-sets/py-set-union.py
py-set-union.py
py
318
python
en
code
72
github-code
1
18286028278
import os, sOE import matplotlib.pyplot as plt from Request import module from cassiopeia import riotapi from cassiopeia.type.core.common import LoadPolicy import pprint def main(): name = "Céll" region = "NA" key = os.environ["DEV_KEY"] riotapi.set_api_key(key) riotapi.set_load_policy(LoadPolicy...
plyte/Creep-My-Score
Driver.py
Driver.py
py
1,405
python
en
code
1
github-code
1
7742861202
import numpy as np import matplotlib.pyplot as plot import math def sigmoid(u): return 1 / (1 + math.exp(-u)) sigmoid_matrix = np.vectorize(sigmoid) def digitize(x, y): return 1 if (x >= y) else 0 digitize_matrix = np.vectorize(digitize) class Layer(object): def __init__(self, name, learning_rate, we...
otaviocx/disciplina-tarp
boltzmann.py
boltzmann.py
py
3,907
python
en
code
1
github-code
1
38950075756
# Imports from flask import Flask, send_from_directory, jsonify, render_template, request, make_response, redirect, url_for, escape, send_file import json from flask_cors import CORS from werkzeug.utils import secure_filename import os import sys import hashlib import secrets import base64 # Adding all files for impor...
ahanabhattchrya/eSlay
backend/app/app.py
app.py
py
9,922
python
en
code
3
github-code
1
23051427840
#AnáliseDeDadosDoGrupo tot18 = 0 totH = 0 totM20 = 0 while True: print('-'*27) print(' CADASTRE UMA PESSOA ') print('-'*27) idade = int(input('Idade: ')) sexo = ' ' while sexo not in 'MF': sexo = str(input("Informe seu sexo: [M/f]: ")).strip().upper()[0] if idade >= 18: tot18 += 1 if sexo == 'M': to...
ruirodriguessjr/Python
EstruturaRepetição/ex23AnáliseDeDadosDoGrupo.py
ex23AnáliseDeDadosDoGrupo.py
py
671
python
pt
code
0
github-code
1
34370342764
from master.importer.axis_subset import AxisSubset from master.provider.metadata.coverage_axis import CoverageAxis from master.importer.interval import Interval from master.provider.metadata.axis import Axis from master.provider.metadata.grid_axis import GridAxis from master.provider.metadata.regular_axis import Regula...
kalxas/rasdaman
applications/wcst_import/master/helper/gdal_axis_filler.py
gdal_axis_filler.py
py
4,210
python
en
code
4
github-code
1
22727159189
import os import cv2 import time name = 'trial' file_format = '.mp4' fps = 24.0 res = '480p' duration = 30 # Standard Video Dimensions STD_DIMENSIONS = { "480p": (640, 480), "720p": (1280, 720), "1080p": (1920, 1080), "4k": (3840, 2160), } # Set resolution for the video capture def change_res(cap, w...
farhanfuadabir/video-recorder
main.py
main.py
py
1,670
python
en
code
0
github-code
1
22689523314
#-*-coding:utf-8-*- __author__ = 'shenshen' from node import Node class Stack(object): def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(s...
dslwz2008/pythoncodes
algorithms/stack.py
stack.py
py
5,930
python
en
code
3
github-code
1
17923722935
# Someone in Dreadsbury Mansion killed Aunt Agatha. Agatha, the butler, and # Charles live in Dreadsbury Mansion, and are the only ones to live there. A # killer always hates, and is no richer than his victim. Charles hates noone # that Agatha hates. Agatha hates everybody except the butler. The butler hates # everyone...
xoolive/facile
examples/who_killed_agatha.py
who_killed_agatha.py
py
2,564
python
en
code
21
github-code
1
71317077794
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torch.optim import Adam import numpy as np import datasets, networks, utils, loss, kernels, options import os import sys import time import tqdm def train(loader, model, optimizer, criterion, epoch, d1, ...
teboli/CPCR
train_lchqs.py
train_lchqs.py
py
7,650
python
en
code
25
github-code
1
12092731167
#!/bin/python3 import math import os import random import re import sys def compareTriplets(a, b): score=[0,0] for i in range(len(a)): if a[i]>b[i]: score[0]+=1 if a[i]<b[i]: score[1]+=1 return score if __name__ == '__main__': a = list(map(int, input().rstrip()...
mariangelabonghi/HackerRank-Practice-Python
ProblemSolving/compare_triplets.py
compare_triplets.py
py
433
python
en
code
0
github-code
1
72116078755
import os import pickle import shutil import tempfile import unittest from rnn_prof import run_rnn as undertest from rnn_prof.data.constants import ASSISTMENTS from rnn_prof.data.splitting_utils import split_data from rnn_prof.data.wrapper import load_data, DEFAULT_DATA_OPTS ASSISTMENTS_TESTDATA_FILENAME = os.path.jo...
Knewton/edm2016
rnn_prof/tests/test_run_rnn.py
test_run_rnn.py
py
2,499
python
en
code
58
github-code
1
35916248021
# Tutorials > 30 Days of Code > Day 22: Binary Search Trees # Given a binary tree, print its height. # # https://www.hackerrank.com/challenges/30-binary-search-trees/problem # class Node: def __init__(self,data): self.right=self.left=None self.data = data class Solution: def insert(self,root,da...
rene-d/hackerrank
tutorials/30-days-of-code/30-binary-search-trees.py
30-binary-search-trees.py
py
1,262
python
en
code
72
github-code
1
72492188833
"""Temporary utility for visualising the data contained in the weather files. This file is now being kept solely as a record of the development process.""" from scraper.scraping_tools import get_files, get_xml from datetime import datetime import plotly.graph_objects as go class WeatherEntry: # make a method that...
Dalia-21/weather-forecast
deprecated/xml_display.py
xml_display.py
py
4,913
python
en
code
0
github-code
1
6788616069
from flask import Flask, jsonify import requests import csv from io import StringIO import datetime from lib.countries import countries from lib.date import getDate app = Flask(__name__) url = "https://github.com/CSSEGISandData/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_daily_reports/" def get_data(b_url...
kojo-shark/pase-python
app.py
app.py
py
2,058
python
en
code
0
github-code
1
24680179890
class Solution: def pivotIndex(self, nums: List[int]) -> int: prefix = list(accumulate(nums)) for i,num in enumerate(nums): if prefix[i] - nums[i] == prefix[-1] - prefix[i]: return i return -1
YosefAyele/Leetcode-and-Codeforces-Problems
0724-find-pivot-index/0724-find-pivot-index.py
0724-find-pivot-index.py
py
297
python
en
code
2
github-code
1
73811145954
import requests from bs4 import BeautifulSoup import pandas as pd shop_name = 'allactive' def get_href(ctgr_list, gender, type_): df = pd.DataFrame() for ctgr in ctgr_list: print(f'<<<<<<<<<<<<<<<<<<<<<<<<{ctgr}>>>>>>>>>>>>>>>>>>>>>>>') page = 1 while True: print(f'---------...
limjun92/team8_project
ssy/크롤링코드및데이터/2차/allactive/allactive.py
allactive.py
py
1,604
python
en
code
0
github-code
1
34086039184
""" This file computes the mutual information between every pair of variables in the specificed Bayes net """ import pandas as pd import numpy as np import pickle from itertools import product from argparse import ArgumentParser from tqdm import tqdm import sys sys.path.extend(["../core", "./code/core"]) from pyprojroo...
benpry/why-think-step-by-step
code/evaluate/mutual_informations.py
mutual_informations.py
py
2,310
python
en
code
7
github-code
1
6604463868
import os # os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # os.environ["CUDA_VISIBLE_DEVICES"] = "1" import torch import torch.nn as nn from torch import optim from torch.autograd import Variable import torch.nn.functional as F from src.python.digo_utils import * from pymongo import MongoClient from tqdm import tq...
yotamfr/prot2vec
src/python/digo_prot2vec.py
digo_prot2vec.py
py
9,477
python
en
code
10
github-code
1
7029268671
#!/usr/bin/python3 import asyncio import evdev from evdev import * import dbus_next from dbus_next.aio import MessageBus import time import logging from hid_scanner import HidScanner from usb_hid_decoder import UsbHidDecoder class KvmMouse(object): def __init__(self): self.event_mice = dict() async ...
BLeeEZ/rpi-kvm
rpi_kvm/mouse.py
mouse.py
py
7,617
python
en
code
27
github-code
1
41407353092
# 139. Word Break # https://leetcode.com/problems/word-break/ # https://leetcode.com/problems/word-break/discuss/43788/4-lines-in-Python/142456 class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: ok = [True] max_len = max(map(len, wordDict + [''])) for i in range(1...
aszx4510/LeetCode
python/0139-word_break.py
0139-word_break.py
py
1,327
python
en
code
0
github-code
1
13562130219
user_input = input('Enter a phrase or press "q" to exit: ') #phrase = (user_input.replace('of','')).split() phrase = user_input.split() _phrase = '' for word in phrase: if user_input.lower() == 'q': break if word.lower() == 'of': continue for s in word: if s == word...
Chephos/beginner-tasks
acronym_generator.py
acronym_generator.py
py
416
python
en
code
0
github-code
1
24260789969
# -*- encoding: utf-8 -*- import ovh # create a client using configuration client = ovh.Client() ck = client.new_consumer_key_request() ck.add_recursive_rules(ovh.API_READ_WRITE, "/domain") ck.add_recursive_rules(ovh.API_READ_WRITE, "/ip") # Request token validation = ck.request() print("Please visit %s to authent...
danielfdickinson/ivc-in-the-wtg-experiments
experiments/Set-001/X-003/get-domain-ip-consumer-key.py
get-domain-ip-consumer-key.py
py
497
python
en
code
0
github-code
1
70706180514
import paho.mqtt.client as mqtt import time #import PWM #import grovepi import grove_rgb_lcd from grove_rgb_lcd import * import statistics # GrovePi + Grove Buzzer import time import grovepi # Connect the Grove Buzzer to digital port D8 # SIG,NC,VCC,GND buzzer = 3 button = 4 grovepi.pinMode(button,"INPUT") #note_prod...
usc-ee250-spring2021/lab05-the-duo
ee250/lab05/lcd_tuner2.py
lcd_tuner2.py
py
3,181
python
en
code
0
github-code
1
6878332946
import os def main(): if os.path.exists("./data.txt") is False: print("data file not exists") return if os.path.exists("./thai_data.txt") is False: print("thai data file not exists") return # Read data f = open("./data.txt") row = f.readlines() ja_animal_list =...
HuaSheng2000/onomatopoeia-thai-ja
main.py
main.py
py
2,379
python
en
code
0
github-code
1
32886057082
from settings.common import get_vocabulary, word_frequency import numpy as np from nltk.corpus import stopwords def count_stopwords(d, stopwords): c = 0 for w in d: if w in stopwords: c += 1 return c def get_data_stats(dataset): dataset_size = len(dataset) vocab_size = len(get...
GU-DataLab/topic-modeling-textPrep
evaluation_metrics/dataset_stats.py
dataset_stats.py
py
872
python
en
code
5
github-code
1
14386219701
""" ## 14-4. 이진 트리 반전 이진 트리를 좌우 반전 시켜라. """ from typing import * import collections # 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 = right class Solution: def invertTree(self, root: Tre...
hyo-eun-kim/algorithm-study
ch14/saeyoon/ch14_4_saeyoon.py
ch14_4_saeyoon.py
py
1,732
python
en
code
0
github-code
1
22575948997
import sys input= sys.stdin.readline n = int(input()) n_list = list(map(int,input().split())) stack=[] result = [0]*n for i in range(n): v= n_list[i] while stack and n_list[stack[-1]]<v: stack.pop() if stack: result[i]=stack[-1]+1 stack.append(i) print(*result)
dydwkd486/coding_test
baekjoon/python/baekjoon2493.py
baekjoon2493.py
py
298
python
en
code
0
github-code
1
31828763438
# -*- coding: utf-8 -*- """ Created on Wed Jun 30 13:01:43 2021 @author: MI2 """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import tia.bbg.datamgr as dm from datetime import date as dt from pandas.tseries.offsets import BDay startDate = dt(1980,1,1) endDate = dt(2020,12,31) ...
tommyoneil/Market-Models
Extras/VWAP.py
VWAP.py
py
1,962
python
en
code
0
github-code
1
5586775092
def pthFactor(n, p): from functools import reduce factors = reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0 )) factors.sort() if p > len(factors): return 0 return factors[p - 1] import time t1 = time.time() print(pthFactor(10**15, 5)) print(f"finished in {ti...
tejas-adg/Code_of_Codswallop
Python_Programs/ATA_Prob/p2_sol.py
p2_sol.py
py
342
python
en
code
0
github-code
1
28909376277
import random import datetime import torch from tqdm import tqdm from src.utils.load_data import load_tables from src.utils.reproducibility import set_random_seed from src.model.pretrain import PretrainMatching from src.graph_construction.tabular_graph import TabularGraph tables = None def pretrain(config): set...
FeiWang96/GTR
src/train/run_pretraining.py
run_pretraining.py
py
3,289
python
en
code
34
github-code
1
26017357281
##################################################################### # cloudsync is a simple python script using NetApp Cloud Rest API # Jerome.Blanchet@NetApp.com ##################################################################### import netapp_api_cloud import argparse import getpass import sys import configparser...
jbnetapp/demo-netapp-cloud-api
cloudsync.py
cloudsync.py
py
12,812
python
en
code
1
github-code
1
4752275130
import os import openai openai.api_key = "" def get_completion(prompt, model="gpt-3.5-turbo"): messages = [{"role": "user", "content": prompt}] response = openai.ChatCompletion.create( model=model, messages=messages, temperature=0, ) return response.choices[0].message["content...
yeonieheoo/MemoryCompanion
ML4H_LLM/case57.py
case57.py
py
2,807
python
en
code
0
github-code
1
71732253793
####################################################################################################### # LICENSE # Copyright (C) 2021 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH - BRAZIL # This program is free software: you can redistribute it and/or modify it under the terms of the GNU # General Public Licens...
diegormsouza/SHOWCast-2.3.0_a
html_update.py
html_update.py
py
4,684
python
en
code
3
github-code
1
75256462113
class Solution(object): def matrixReshape(self, nums, r, c): """ :type nums: List[List[int]] :type r: int :type c: int :rtype: List[List[int]] """ if len(nums) * len(nums[0]) != r * c: return(nums) l = [] new = [] for i in r...
HawkinYap/Leetcode
leetcode566.py
leetcode566.py
py
603
python
en
code
0
github-code
1
8502662374
from app import app from flask import Blueprint, request, make_response, redirect, render_template, url_for, flash, json, jsonify, send_file import requests import re import os from .ortools import * from .st_classes import * GMAPS_KEY = os.getenv('GMAPS_API') DEPOT = 'Sacramento, CA, USA' def flash_errors(form): f...
amiller5233/truck-routing-application
app/views.py
views.py
py
3,358
python
en
code
0
github-code
1
29700790419
#!/usr/bin/env python import os def split(sdf_path, dirname=""): """split the molecules in one sdf into individual files Keyword Arguments: sdf_path -- file path dirname -- output directory, the same directory as the input file by default """ section = [] if dirname == "": dirnam...
GeauxEric/GPUdock
GeauxBind/script/split_sdf.py
split_sdf.py
py
935
python
en
code
1
github-code
1
17514977530
import argparse import yaml from src.processed import PROCESSED parser = argparse.ArgumentParser() parser.add_argument("--config", type=str, required=True, help="path to yaml config") args = parser.parse_args() with open(args.config, mode="r") as stream: config = yaml.safe_load(stream) if __name__ == "__main_...
EDJINEDJA/foot-ml
app.py
app.py
py
382
python
en
code
0
github-code
1
31445927920
import math import torch from timm.scheduler import CosineLRScheduler from torch.optim.lr_scheduler import LambdaLR class FlatAnnealLR(torch.optim.lr_scheduler.LambdaLR): """ Schedule LR linear anneal from 1.0 to `eta_min` after `T_max * flat_ratio` steps. """ def __init__( self, opt...
Stardust87/VIP
src/utils/scheduler.py
scheduler.py
py
2,339
python
en
code
0
github-code
1
43044435979
from fenics_concrete.experimental_setups.experiment import Experiment from fenics_concrete.helpers import Parameters import dolfin as df import numpy as np import gmsh import os import meshio import warnings from ffc.quadrature.deprecation import QuadratureRepresentationDeprecationWarning warnings.simplefilter("ignore...
BAMresearch/FenicsConcrete
fenics_concrete/experimental_setups/concrete_cylinder.py
concrete_cylinder.py
py
10,324
python
en
code
0
github-code
1
35703348051
#!/usr/bin/python3 import math HALF_LIFE = 6 * 3600 # seconds A0 = 1000.0 LAMBDA = math.log(2) / HALF_LIFE TIME_MAX = 25 * 3600 # seconds def main(): # for each hour for seconds in range(0, TIME_MAX, 3600): A = A0 * math.exp(-seconds * LAMBDA) print(f"Relative quantity remaining after the ...
NikosDelijohn/CS-polito
lab04/ex2-2.py
ex2-2.py
py
400
python
en
code
30
github-code
1
35325919453
import numpy as np # Writing equations in matrix form matrix = np.array([[0, 2, 0, 1, 0], [2, 2, 3, 2, -2], [4, -3, 0, 1, -7], [6, 1, -6, -5, 6]], float) mat_len = len(matrix[:, 0]) # Iterations: for i in range(mat_len): where = np.where(abs(matrix[i:, i])...
neerajkambojin/ch481
Assignment6/Program_c.py
Program_c.py
py
1,080
python
en
code
0
github-code
1
42108724860
"""Apple.py: File that handle the apple display and collision""" import pygame import random __author__ = "Magalie Vandenbriele" __credits__ = ["Magalie Vandenbriele", "Pierre Ghyzel", "Irama Chaouch"] __license__ = "GPL" __version__ = "1.0" __maintainer__ = ["Magalie Vandenbriele", "Irama Chaouch"] __email__ = "maga...
magalieV/SW_Project_Snake
game_module/gameplay/Apple.py
Apple.py
py
2,398
python
en
code
0
github-code
1
73509776035
""" Set up the plot figures, axes, and items to be done for each frame. This module is imported by the plotting routines and then the function setplot is called to set the plot parameters. """ from __future__ import absolute_import import numpy #-------------------------- def setplot(plotdata=None): #---------...
cheginit/SI_2019_Coastal
models/GeoClaw/mobile_bay/setplot.py
setplot.py
py
4,928
python
en
code
2
github-code
1
31900707389
# -*- coding: utf-8 -*- """ @File : complexNumberMultiply.py @Author : wenhao @Time : 2023/3/14 11:09 @LC : 537 """ class Solution: def complexNumberMultiply(self, num1: str, num2: str) -> str: num1 = num1.split('+') x1, y1 = int(num1[0]), int(num1[1][:-1]) num2 = num2.split(...
callmewenhao/leetcode
官方/字符串/complexNumberMultiply.py
complexNumberMultiply.py
py
479
python
en
code
0
github-code
1
384341994
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('school', '0014_auto_20161012_0659'), ] operations = [ migrations.AlterField( model_name='student', n...
suryakumar1024/schoolcms
school/migrations/0015_auto_20161013_1126.py
0015_auto_20161013_1126.py
py
461
python
en
code
0
github-code
1
2819717353
from app import app, db, load_user from app.models import User, Order, Admin, Reseller, Product, Item from app.forms import SignUpForm, SignInForm, CreateOrderForm, ProductForm from flask import render_template, redirect, url_for, request, flash, session from flask_login import login_required, login_user, logout_user, ...
simaomansur/project-1-windoors
app/routes.py
routes.py
py
10,950
python
en
code
1
github-code
1
3211690613
from keras.models import Sequential, Model import numpy as np from keras.layers import Input, Dense, Activation, concatenate from keras.optimizers import Adam import math import csv main_input = Input(shape=(2,), dtype="float32", name='main_input') x = Dense(64, activation='tanh')(main_input) x = Dense(64, activation...
Lucianobianchi/locomovil-api
net_late_input.py
net_late_input.py
py
2,757
python
en
code
0
github-code
1
72072560995
from transformers import GPTNeoXForCausalLM, AutoTokenizer, BitsAndBytesConfig, AutoModelForCausalLM import torch tokenizer = AutoTokenizer.from_pretrained('gpt2') model = AutoModelForCausalLM.from_pretrained("gpt2") message = '<|prompter|> hello<|endoftext|><|assistant|>' inputs = inputs = tokenizer(message, retur...
ElHaban3ro/RetroAssistant
test.py
test.py
py
481
python
en
code
0
github-code
1
12644162333
# -*- coding: utf-8 -*- """ Created on Tue Apr 4 20:51:47 2023 @author: erica """ import random class Agent(): def __init__(self, i): """ The constructor method. Parameters ---------- i : Integer To be unique to each instance. Retur...
ericaanderson/Module3
src/abm4/agentframework.py
agentframework.py
py
942
python
en
code
0
github-code
1
29761062732
from td.oauth import TdAmeritradeOauth from configparser import ConfigParser # Initialize the Parser. config = ConfigParser() # Read the file. config.read('config/config.ini') # Get the specified credentials. client_id = config.get('main', 'client_id') redirect_uri = config.get('main', 'redirect_uri') # Initialize ...
Gaukhar-ai/td-ameritrade-api
samples/use_oauth.py
use_oauth.py
py
464
python
en
code
null
github-code
1
71015825635
# Title: 3Sum # Link: https://leetcode.com/problems/3sum/ from itertools import combinations from collections import defaultdict class Solution: def threeSum(self, nums: list) -> list: ans = [] nums = sorted(nums) prev_num = None for i, num in enumerate(nums): if num ...
yskang/AlgorithmPractice
leetCode/3_sum_3.py
3_sum_3.py
py
1,242
python
en
code
1
github-code
1
72149002593
# we need pyaudio to get sound from microphone import pyaudio import speech_recognition as sr import webbrowser import os r = sr.Recognizer() # TODO: null deger donunce hata veriyor try except kur # TODO: key value değeri olarak komutları txt de tut, program üzerinden key value ekle # TODO:3 4 tane yeni özellik ekle...
tburakg/bitirme_projesi
main.py
main.py
py
2,965
python
tr
code
0
github-code
1
18905086139
#coding:utf-8 import time import ipdb import argparse import tensorflow as tf from agent import Agent from deep_q_network import FRLDQN from environment import Environment from replay_memory import ReplayMemory from utils import get_time, str2bool def args_init(): parser = argparse.ArgumentParser() envarg ...
FRL2019/FRL
gridworld/main.py
main.py
py
16,146
python
en
code
35
github-code
1
30655390894
# 获取系统信息的模块 import psutil import time # m每隔一秒绘制CPU的占有率; 如何持久化保存? 如何将时间和对应的cpu占有率匹配; while True: # 获取当前时间和cpu占有率 t = time.localtime() cur_time = '%d:%d:%d' %(t.tm_hour, t.tm_min, t.tm_sec) cpu_res = psutil.cpu_percent() # print(cpu_res) # 保存到文件中; with open('cpu.txt', 'a+') as f: ...
lvah/201903python
day12/code/17_获取系统信息.py
17_获取系统信息.py
py
491
python
en
code
5
github-code
1
12452588524
# selection screen for the PicoGameBoy by David Monninger, written for SPE Karlsruhe import os from PicoGameBoy import PicoGameBoy import time TEXT_DISTANCE = 10 BLACK = PicoGameBoy.color(0, 0, 0) WHITE = PicoGameBoy.color(255, 255, 255) games = [f for f in os.listdir("/") if f.startswith("g_")] # collect all possib...
spe-khe/PicoG
main.py
main.py
py
2,126
python
en
code
0
github-code
1
43796258612
# Write a Python program to convert a list of tuples into a dictionary t=[("akash", 10), ("gaurav", 12), ("anand", 14),("suraj", 20), ("akhil", 25), ("ashish", 30)] # First My way d1={} for a,b in t: d1[a]=b print(d1) # predefined dict() method in dictionaries d2={} d2=dict(t) print(d2) # predefined setdefault(k...
Diptiman1999/264725_DailyPractice_Python
22_04_2021_Assignment/list_tuple_into_dictionary.py
list_tuple_into_dictionary.py
py
398
python
en
code
0
github-code
1
23114807108
from models.PersonsModel import PersonsModel from core.Controller import Controller from views.LoginFrame import LoginFrame from pubsub import pub import wx class LoginController(Controller): def __init__(self, session=None, parent=None): super().__init__(session) self.model: PersonsModel = Person...
hifra01/aplikasi-wisata
src/controllers/auth/LoginController.py
LoginController.py
py
2,156
python
en
code
0
github-code
1
21840933315
import sys input = sys.stdin.readline def recur(cur, protein, fat, carbo, vita, cost): global ans, ans_ls if cur == n: if protein >= min_val[0] and fat >= min_val[1] and carbo >= min_val[2] and vita >= min_val[3]: if cost < ans: ans = cost ans_ls = [...
pearl313/BOJ
백준/Gold/19942. 다이어트/다이어트.py
다이어트.py
py
1,005
python
en
code
0
github-code
1
5163812852
#!/usr/bin/env python # -*- coding: utf-8 -*- import copy import argparse import cv2 as cv import numpy as np import tensorflow as tf from utils import CvFpsCalc from mlsd.utils import pred_lines, pred_squares def get_args(): parser = argparse.ArgumentParser() parser.add_argument("--device", type=int, defa...
Kazuhito00/M-LSD-warpPerspective-Example
example.py
example.py
py
5,989
python
en
code
10
github-code
1
22512034598
''' Created on 25/04/2013 @author: 8620016 ''' # Conectando `a um banco de dados sqllite tempor´ario, # na memoria do computador. from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer from sqlalchemy import String, MetaData, ForeignKey from sqlalchemy.orm import mapper from sqlalchemy.orm ...
fredsilva/Pgdasd
SqlAlchemy/Conexao.py
Conexao.py
py
1,257
python
en
code
0
github-code
1
35312536605
# una lista enlazada o anidada es una colección lineal de elementos de datos cuyo orden no esta dado por su ubicación fisica en la memoria, sino que cada elemento apunta al siguiente. # Es una estructura de datos que consiste en una colección de nodos que juntos representan una secuencia en su forma mas basica , cada n...
leafarJS/Algorithms-_basic_with_Python
08_linked_lists.py
08_linked_lists.py
py
2,121
python
es
code
0
github-code
1