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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
31077263477 | def fatorial(n, boolean=False):
'''
-> Calcula o fatorial de um número
:param n: numero do fatorial
:param boolean: Verdadeiro para mostrar a conta, falso para mostrar apenas o resultado
:return:
'''
cont = 1
for n in range(n, 0, -1):
cont *= n
if boolean == True:
... | tainanbogo/Python-Scripts | desafio102.py | desafio102.py | py | 470 | python | pt | code | 0 | github-code | 13 |
28521822550 | import os
import sys
import syslog
import hashlib
import xml.etree.ElementTree as tree
import time
from time import sleep
def calcHashNorm(path_normal_files, update):
for i in range(len(path_normal_files)):
sleep(0.0001)
try:
file = path_normal_files[i]
if os.path.isfile(fi... | wolle604/pyfim | pyfim.py | pyfim.py | py | 8,469 | python | en | code | 1 | github-code | 13 |
8585861525 | from musicXmatch import musicXmatch
mm = musicXmatch()
lyrics = "Tonight I'm gonna have myself a real good time"
song_list = mm.get_song_list_by_lyrics(lyrics)
print('Select one of the following options: ')
for i in range(len(song_list)):
print('[{:>2}'.format(i) + '] : ' + song_list[i][1] + ' by ' + song_lis... | dvilelaf/SpaceRocksBot | original/test.py | test.py | py | 592 | python | en | code | 2 | github-code | 13 |
38950753598 | #!/usr/bin/env python
# coding: utf-8
# # Predicting Student Admissions with Neural Networks
# In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data:
# - GRE Scores (Test)
# - GPA Scores (Grades)
# - Class rank (1-4)
#
# The dataset originally came from here: http://... | ruhiawasthi/Udacity--Introduction-To-Machine-Learning-With-Tensorflow | Predicting Student Admissions with Neural Networks/StudentAdmissions.py | StudentAdmissions.py | py | 7,445 | python | en | code | 4 | github-code | 13 |
31167833172 | from selenium import webdriver
import time
from selenium.webdriver.support.ui import WebDriverWait
with webdriver.Firefox() as driver:
wait = WebDriverWait(driver, 10)
tweet_fill = "http://127.0.0.1:5000/"
driver.get(tweet_fill)
driver.maximize_window()
time.sleep(15)
driver.find_element_by_na... | thisislohith6/tweet | test_selenium.py | test_selenium.py | py | 416 | python | en | code | 0 | github-code | 13 |
43356131713 | import sys
read = sys.stdin.readline
N = int(read())
palindroms = list((read().rstrip().split()))
for i in range(1,N):
# 뒷 글자의 맨 앞자리 vs 앞글자의 맨 뒷자리
if palindroms[i-1][-1] != palindroms[i][0]:
print(0)
exit()
print(1) | w00sung/Algorithm | BOJ/GoodBye2020_A.py | GoodBye2020_A.py | py | 276 | python | ko | code | 0 | github-code | 13 |
1249599288 | import logging
from typing import Dict, List
from kedro.io import MemoryDataSet
import numpy as np
import pandas as pd
from google.cloud import bigquery
def train_model(data: pd.DataFrame, parameters: Dict) -> pd.DataFrame:
"""Split data and train the linear regression model.
Args: parameters: Parameters ... | mahurtado/spaceflights | src/spaceflights/pipelines/data_science/nodes.py | nodes.py | py | 1,963 | python | en | code | 2 | github-code | 13 |
31672495915 | from car import Car
from player import Player
from menu import menu
import time
from colorama import Back
from subprocess import call
import os
def clear():
call('clear' if os.name == 'posix' else 'cls')
#Menu.main_menu()
# name = (input("Enter your Name: "))
# player = Player(name)
# print(f"\nWelcome to RACING ... | Matt-Robinson-byte/python-text-rpg | game.py | game.py | py | 1,597 | python | en | code | 0 | github-code | 13 |
16993165913 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 27 11:47:22 2020
@author: William
"""
#%%
#imports
from drlAgents import DDQNAgent
import matplotlib.pyplot as plt
import gym
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
#%%
#Set a seed to compare results
seed = 42
torch.manual_se... | williambankes/drlAgents | scripts/ddqn_agent_test.py | ddqn_agent_test.py | py | 1,237 | python | en | code | 0 | github-code | 13 |
32566213339 | from tkinter import *
from PIL import ImageTk, Image
root = Tk()
root.title('Radio Buttons')
root.iconbitmap('Images/WillRagB.ico')
MODES = [
# "Label", "Value"
# for the examble:
# (Toppings, Value)
("Pepperoni", "Pepperoni"),
("Peppers", "Peppers"),
("Mushroom", "Mushroom"),
("Onion", "... | WilliamW5/Tkinter | radio.py | radio.py | py | 1,228 | python | en | code | 0 | github-code | 13 |
20191102479 |
import tensorflow as tf
import numpy as np
from vqvae import soft_em
from model import transformer_relative_position
from audio_io import utils as audio_utils
import collections
import copy
import json
import math
import re
import numpy as np
import six
import tensorflow as tf
import os
"""
https://github.com/huseinz... | yyht/deepspeech | model/conformer.py | conformer.py | py | 41,450 | python | en | code | 2 | github-code | 13 |
36467208493 | import re
import requests
class TronGazer:
apiPrev = 'https://ilearn.ttu.edu.tw/api/'
def __init__(self):
self.session = requests.session()
headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.152 ... | ssrtw/TronGazer | TronGazer.py | TronGazer.py | py | 3,686 | python | zh | code | 0 | github-code | 13 |
28352167049 | from aiogram.dispatcher import FSMContext
from loader import dp, db
from aiogram import filters, types
from bot.keyboards.inline.PurchasesKeyboards.PurchaseKeyboard import CreatePurchase
from bot.states.FormToJoinAsBuyer import FormToJoinAsBuyer
from bot.utils.misc.decorators import check_if_user_is_registered
from bo... | nazfurdychka/share-bot | bot/handlers/groups/callbacks/purchases.py | purchases.py | py | 4,140 | python | en | code | 0 | github-code | 13 |
33794470134 | from __future__ import print_function, division
import tensorflow as tf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn
from sklearn.cross_validation import train_test_split
import random
# 设置模型
learning_rate = 0.001
training_epochs = 50
batch_size = 100
display_step ... | kEva0v0/Prepare-For-Interview | LR.py | LR.py | py | 1,631 | python | en | code | 0 | github-code | 13 |
20625989485 | from pathlib import Path
import numpy as np
import pandas as pd
import tensorflow as tf
if __name__ == "__main__":
ratings_path = Path("data", "ratings_clean.csv")
ratings = pd.read_csv(ratings_path)
explicit_ratings = ratings.loc[ratings.rating != 0]
def get_and_save_mapping(values, filename):
... | coinflip112/bookrecommender | preprocessing/wals_prepare.py | wals_prepare.py | py | 3,583 | python | en | code | 0 | github-code | 13 |
26640563172 | import pytest
from app import schemas
from app import models
def test_get_all_posts(authorized_client, test_posts):
res = authorized_client.get("/posts/")
def validate(post):
return schemas.PostOut(**post)
posts_map = map(validate, res.json())
posts_list = list(posts_map)
# print(res.jso... | trungtruc123/FASTAPI | tests/test_posts.py | test_posts.py | py | 4,684 | python | en | code | 0 | github-code | 13 |
37946592628 | # This file was automatically created by FeynRules $Revision: 573 $
# Mathematica version: 8.0 for Microsoft Windows (32-bit) (February 24, 2011)
# Date: Tue 2 Jul 2013 00:32:00
from object_library import all_parameters, Parameter
from function_library import complexconjugate, re, im, csc, sec, acsc, asec... | rushioda/PIXELVALID_athena | athena/Generators/MadGraphModels/python/models/VLQ_UFO/parameters.py | parameters.py | py | 34,221 | python | en | code | 1 | github-code | 13 |
16951742507 | import csv
import matplotlib.pyplot as plt
import gender_guesser.detector as gender
DELIMITER = ";"
FILE = "list.csv"
ALL_STUDENTS_AUD = "all_students_aud.csv"
ALL_STUDENTS_CC = "all_students_cc.csv"
ALL_GROUPS_AUD = "all_groups_aud.csv"
ALL_GROUPS_CC = "all_groups_cc.csv"
students = []
all_students = {}
class Stud... | lkoehl/studip-csv-analyzer | csv-analyzer.py | csv-analyzer.py | py | 7,133 | python | en | code | 0 | github-code | 13 |
17072588067 | import tkinter as tk
root = tk.Tk() # This creates the main window of the tkinter application
total_expenses_label = tk.Label(root, text="Total Expenses: $0.00")
total_expenses_label.pack()
root.mainloop() # This runs the Tkinter event loop which handles user input and updates the GUI
# create a Tkinter window
windo... | LKocaj/pythonPractice1 | expenses2.py | expenses2.py | py | 4,543 | python | en | code | 0 | github-code | 13 |
7835052930 | import time
from pathlib import Path
from typing import Generator, Tuple
import pytest
from tests.factories import SecureDropConfigFactory
from tests.functional.app_navigators.source_app_nav import SourceAppNavigator
from tests.functional.conftest import SdServersFixtureResult, spawn_sd_servers
from tests.functional.p... | freedomofpress/securedrop | securedrop/tests/functional/pageslayout/test_source_session_layout.py | test_source_session_layout.py | py | 2,917 | python | en | code | 3,509 | github-code | 13 |
6287697497 | # sort subjects by their performance in the first part of the experiment
# this script creates a variable that indicates whether they were better than random in the first 20 rounds and plots
# the effect of revealing/allowing an additional variable.
import warnings
warnings.simplefilter(action='ignore', category=Futur... | Jimena-Galindo/learning_polarization | analysis/part1_performance.py | part1_performance.py | py | 3,578 | python | en | code | 0 | github-code | 13 |
12947806619 | import socket
from time import strftime
host = ''
port = 12345
addr = (host, port)
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(addr)
s.listen(2)
while True:
cli_socket, cli_addr = s.accept()
while True:
data =cli_socket.recv(1024)
if data.decode().strip(... | HLQ1102/MyPython | devops/py01/tcp_time_serv.py | tcp_time_serv.py | py | 514 | python | en | code | 0 | github-code | 13 |
32895555611 | def my_project_path(my_project):
"""
output: Path to the folder where the project is
"""
# If there is a project, mufolder will be location of the project
if my_project.fileName()!='':
print('project', Path(my_project.fileName()).stem , 'loaded')
return Path(my_project.ho... | isa-ulisboa/qgis-python | my_functions.py | my_functions.py | py | 19,060 | python | en | code | 0 | github-code | 13 |
34737807299 | import math
import torch
from torch import nn
import my_plt
import test_attention_cues
import train_framework
# 为了仅将有意义的词元作为值来获取注意⼒汇聚,我们可以指定⼀个有效序列⻓度(即词元的个数),
# 以便在计算softmax时过滤掉超出指定范围的位置。
# 通过这种⽅式,我们可以在下⾯的masked_softmax函数中实现这样的掩蔽softmax操作。
#@save
def masked_softmax(X, valid_lens):
"""通过在最后⼀个轴上掩蔽元素来执⾏softmax操作"""
# X... | lucelujiaming/luceluDiveIntoDeepLearning | ch14_natural_language_processing_pretraining/test_attention_scoring_functions.py | test_attention_scoring_functions.py | py | 5,994 | python | zh | code | 0 | github-code | 13 |
15726111250 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Python 程式的第一、二行一定是如上所示,請不要略過了。
#file.py
f=open("./sample.txt","r")
b=f.read()
f.close()
"""------------------------------------讀取資料"""
k=[]
str(k)
for i in range(0,len(b),1):
k.append(b[i])#將字串轉為陣列
if(ord(k[i])<ord('A')or ord(k[i])>ord('z')):
k[i]=' '#將... | PeterWolf-tw/ESOE-CS101-2016 | homework1_b05505028.py | homework1_b05505028.py | py | 1,436 | python | en | code | 15 | github-code | 13 |
24847002900 | #!/usr/bin/python
# encoding: utf-8
import sys
from workflow import Workflow
log = None
def main(wf):
import subprocess
# Get args from Workflow as normalized Unicode
args = wf.args
# get the paths of query matches
project_paths = subprocess.check_output([
... | riotbit/sublimeprojects-workflow | sublimeprojects-workflow.py | sublimeprojects-workflow.py | py | 1,415 | python | en | code | 1 | github-code | 13 |
24660421699 | import asyncio
from asyncio import Task, CancelledError
from typing import Optional
from store import Store
from vk_bot.data_classes import TypeMessage
class Poller:
def __init__(self, store: Store):
self.store = store
self.is_running = False
self.poll_task: Optional[Task] = None
asy... | VIVERA83/game_sapper | game_sapper/store/manager/poller.py | poller.py | py | 1,169 | python | en | code | 0 | github-code | 13 |
7385707177 | import nextcord
from nextcord import Interaction, SlashOption
from nextcord.ext import commands
from discord_utils.embed_validation import validate_embed
from scrapers.discgolfbagbuilder import DiscgolfBagBuilder
from .bagconfig import BagConfig
class Bag(commands.Cog):
"""Bag Class Cog"""
def __init__(self, b... | skaretk/disc-score-bot | discgolfbot/bag/bag.py | bag.py | py | 4,992 | python | en | code | 2 | github-code | 13 |
9019693878 | import cv2
import os
IMG_SIZE = 224
def resize(dirname1, dirname2):
dir_name = dirname2
files = os.listdir(os.getcwd() + '/imgs/' + dirname1 + dirname2)
save_dir = os.getcwd() + '/imgs/' + dirname1 + dirname2 + '/'
print("resize start!")
for file in files:
# 画像読み込み
img = cv2.imread(os.getcwd() + '/i... | ryu1sazae/Sushi_Deep_Learning | resize.py | resize.py | py | 663 | python | en | code | 0 | github-code | 13 |
19522551398 | #-----------------------------------------------------------
# SEABED2030 - B3
# Update metadata table with extent information from B2 (tiling)
#
# (C) 2021 Sacha Viquerat, Alfred Wegener Institute Bremerhaven, Germany
# sacha.vsop@gmail.com & fynn.warnke@awi.de
#------------------------------------------------... | SeaBed2030/IBCSO_v2_Dorschel_et_al_2022 | SEAHORSE/PYTHON/B4_update_metadata.py | B4_update_metadata.py | py | 5,199 | python | en | code | 6 | github-code | 13 |
34060766582 | #!/usr/bin/env python
# Author: Dogacan S. Ozturk
# Function to calculate integrals.
def calculate_point_integral(numberOfPoints, delta, val):
intVal = 0.0
for i in range(numberOfPoints):
intVal = intVal+(i*delta*val)/(numberOfPoints-1)
return intVal
# Function to calculate distance between two p... | dcsozturk/hime | Code/hime_helper_functions.py | hime_helper_functions.py | py | 1,399 | python | en | code | 4 | github-code | 13 |
1816406581 | import torch
import torch.nn as nn
# MomentumOptimizer
class MomentumOptimizer(torch.optim.Optimizer):
# Init Method:
def __init__(self, params, lr=1e-3, momentum=0.9):
super(MomentumOptimizer, self).__init__(params, defaults={'lr': lr})
self.momentum = momentum
self.state = dict()
... | can-git/LossFunctionsComparison | MomentumOptimizer.py | MomentumOptimizer.py | py | 846 | python | en | code | 0 | github-code | 13 |
21373658758 | import numpy as np
"""Ive created 3 phase maps sinusoidally varying from 0 to 255 but when i
plot them they arent in gray scale and im not sure how to do that but these
are the current 3 phase maps """
w=(2*np.pi)/50
Px1 = []
for i in range(800):
Px1.append(127.5*np.sin((w*(i+1))+127.5))
repetitions = 6... | StevenJohnsonOptics/Otoscope_Imaging | Sinewave_plot.py | Sinewave_plot.py | py | 1,301 | python | en | code | 0 | github-code | 13 |
29380053603 | # *** Practical task 3 ***
# Write a function that calculates the number
# of characters included in given string.
def get_num_repeat(phrase: str) -> dict:
"""
Function that calculates the number
of characters included in given string
:param phrase: str
:return: dictionary with the number of charac... | kolyasalubov/Lv-14.03.PythonFundamentals | Stanislav_Hryhorskiy/HW7/hw7_practical_task_3.py | hw7_practical_task_3.py | py | 622 | python | en | code | 0 | github-code | 13 |
20209101264 | import os
import sys
import json
import pytorch_lightning as pl
from bert_utils import create_dataframe, get_stat_details, Model, ToSDataModule
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from transformers import BertTokenizerFast as BertTokenizer
def main():
if len(sys.argv) != 2:
... | MBadriNarayanan/TermsOfServiceClassification | Scripts/bert_train.py | bert_train.py | py | 5,298 | python | en | code | 0 | github-code | 13 |
7315743054 | """
pre_process_datafiles.py
This script preprocesses the output of
"""
import pandas as pd
import numpy as np
import sys
import argparse
import os
import pareto
import subprocess
################ Test Case Setup ###################
# Path
header_file = r"header_files/GTV_CTD_Liver_setup_2_header.txt"
# Update the... | MarcusLG/RT_ConNav_Scripts | pre_process_datafiles.py | pre_process_datafiles.py | py | 8,194 | python | en | code | 0 | github-code | 13 |
5276136446 | #!/usr/bin/env python3
#
# Show difference made by solver tolerances
#
from __future__ import division, print_function
import os
import sys
import pints
import numpy as np
# Load project modules
sys.path.append(os.path.abspath(os.path.join('..', '..', 'python')))
import cells
import data
import model
import results
i... | CardiacModelling/FourWaysOfFitting | figures-unused/u6-solver-tolerance/u6-solver-tolerance.py | u6-solver-tolerance.py | py | 3,357 | python | en | code | 4 | github-code | 13 |
72283148819 | from django.contrib.auth import authenticate, login, get_user_model
from django.http import HttpResponse
from django.shortcuts import render,redirect
import requests
from Allorder.models import Product,Customer
from Allorder .form import UpdateForm
from django.http import HttpResponseRedirect, HttpResponse
def cutomer_... | imdad000/shopifApp | shopifApp/views.py | views.py | py | 2,029 | python | en | code | 0 | github-code | 13 |
35845643557 | # silent bidding program
bids = {}
def check_winer(bids_):
highest_bid = 0
winner = ""
for bid in bids_:
if bids[bid] > highest_bid:
highest_bid = bids_[bid]
winner = bid
return winner, highest_bid
bidding_finished = False
while not bidding_finished:
bidder = inpu... | vasusen-code/100DaysOfCode | beginner/secret_auction.py | secret_auction.py | py | 1,037 | python | en | code | 1 | github-code | 13 |
9296952073 |
import ha
_ha = ha.haproxy (
minimal_configure = True,
)
_fe = _ha.http_frontends.basic ()
_be = _ha.http_backends.basic (_frontend = _fe)
_fe.requests.force_caching_enable ()
_fe.responses.force_caching ()
_ha.output_stdout ()
| cipriancraciun/haproxy-configurator | examples/http-caching-force.py | http-caching-force.py | py | 243 | python | en | code | 2 | github-code | 13 |
43230312156 | #!/usr/bin/env python
from os import path
import sys
# Directory containing this program.
PROGDIR = path.dirname(path.realpath(__file__))
# For click_common and common.
sys.path.insert(0, path.join(PROGDIR, ".."))
# For python_config.
sys.path.insert(0, path.join(PROGDIR, "..", "..", "etc"))
import click_common
impor... | mukerjee/etalon | experiments/buffers/nsdi2020.py | nsdi2020.py | py | 9,228 | python | en | code | 12 | github-code | 13 |
41130662343 | import pygame
import sys
import sqlite3
from class_boton import Button
from game import game, oscurecer_pantalla, draw_text2, draw_text_and_image
from utilidades import cambiar_musica
from vid.pyvidplayer import Video
from configuracion import ANCHO_PANTALLA, ALTO_PANTALLA
from class_game_over import GameOver
pygame.i... | HoracioxBarrios/mi_juego_final_limpio | main.py | main.py | py | 10,634 | python | es | code | 2 | github-code | 13 |
26652442026 | from bloghandler import BlogHandler
from models.user import User
from models.post import Post
from models.like import Like
from models.comment import Comment
from helper import *
from google.appengine.ext import db
class NewPost(BlogHandler):
def get(self):
if self.user:
self.render("newpost.h... | xUansen/udacity-full-stack-nanodegree | @Project3/app/newposthandler.py | newposthandler.py | py | 1,216 | python | en | code | 0 | github-code | 13 |
6922717828 | '''
Dynamic Programming Question.
'''
#INterview Question:
#Leetcode
#Dynamic Problem Question
#O(n²) --> Brute Force Solution
#Dynamic Problem solution:
'''
For example we have:
[-2,-3,4,1,-2,1,5,-3]
max Subarray = [4,-1,-2,5]
#Lets look at the problem stepwise
Initially: max = -inf., currSum = 0
[-2] --> max = -2, c... | Oushesh/CODING_INTERVIEW | interviewing.io/SlackEngineer_maxSubarray.py | SlackEngineer_maxSubarray.py | py | 1,108 | python | en | code | 0 | github-code | 13 |
17053456974 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi
class InvoiceLineInfoOrder(object):
def __init__(self):
self._duty_free_flag = None
self._duty_free... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/InvoiceLineInfoOrder.py | InvoiceLineInfoOrder.py | py | 5,414 | python | en | code | 241 | github-code | 13 |
17049177184 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class BeneficialEntity(object):
def __init__(self):
self._cert_effective_date = None
self._cert_expiration_date = None
self._cert_no = None
self._cert_type = None
... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/BeneficialEntity.py | BeneficialEntity.py | py | 3,020 | python | en | code | 241 | github-code | 13 |
27074944285 | import openai
from openpyxl import Workbook
from openpyxl import load_workbook
from time import sleep
import os
openai.api_key = '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'
print('please input interval time:')
sleeptime=int(input())
#print('please input engine name:')
#enginee=input()
enginels=['text-davinci-... | carryyangorz/pythonprojects | chat.py | chat.py | py | 1,369 | python | en | code | 0 | github-code | 13 |
29113453086 | import logging
import os
from datetime import datetime
from zoneinfo import ZoneInfo
from slack_bolt import App
from slack_bolt.adapter.aws_lambda import SlackRequestHandler
from slack_bolt.adapter.socket_mode import SocketModeHandler
from slack_sdk.web import WebClient
# from ./constants import ZUNDA_EMOJI
ZUNDA_EMO... | Kumamoto-Hamachi/zunda-fairy-bot | src/handler.py | handler.py | py | 2,665 | python | en | code | 0 | github-code | 13 |
70988772497 | import pandas as pd
import numpy as np
import torch
from torch import nn
from torch.nn.functional import interpolate
from torch.utils.data import Dataset, DataLoader
import torch.autograd as autograd
import torch.nn.functional as F
import torch.optim as optim
from sklearn.model_selection import train_test_split
from ... | hangming1992/QMUL-Project | project_CNN.py | project_CNN.py | py | 4,603 | python | en | code | 0 | github-code | 13 |
74449868176 | import requests
BASE_URL = "https://opendata.paris.fr/api/explore/v2.1/catalog/datasets"
def get_dataset_info(dataset_id, **kwargs):
"""
Args:
dataset_id:
**kwargs:
Returns:
"""
url = f"{BASE_URL}/{dataset_id}/records?"
response = requests.get(url, params=kwargs)
if res... | bricefotzo/velib-subscribe | api/external.py | external.py | py | 471 | python | en | code | 0 | github-code | 13 |
73806564818 | #!/usr/bin/env python
import sys
import os
import io
import argparse
from collections import Counter, defaultdict
import pickle
from scorer.reader import *
from scorer.truth import *
from scorer.sDCG import *
from scorer.expected_utility import *
from scorer.cubetest import *
def _years(runs_path):
return [year ... | ekanou/Markovian-Session-Measures | scoring/eval_runs.py | eval_runs.py | py | 8,512 | python | en | code | 0 | github-code | 13 |
74330140176 | import copy
from datetime import datetime, timedelta, time
from package import Package
from hashmap import HashMap
import csv
# Boolean used to prevent updating package 9's address more than once during the optimization algorithm
_address_updated_9 = False
# Will point to copied instance of package 9 with old address... | alexmbright/C950-PackageDeliveryAlgorithm | logistics.py | logistics.py | py | 11,031 | python | en | code | 0 | github-code | 13 |
3239306291 | # -*- coding: utf-8 -*-
from app.bootstrap import Bootstrap
from data.config import Config
from routing.router import Router
from net.request import Request, Builder
from error.errors import Error
class LambdaApp(object):
"""AWS Lambda用アプリケーション"""
def __build_request(self, event: dict) -> Request:
"""イベントデータからリク... | rog-works/python-ws | app/lambdaapp.py | lambdaapp.py | py | 1,514 | python | ja | code | 0 | github-code | 13 |
34278527461 | from datetime import datetime, timedelta
from time import mktime
from test_utils import NellTestCase
from scheduler.models import *
from utils import create_blackout
from utilities.TimeAgent import dst_boundaries, tz_to_tz
class TestBlackout(NellTestCase):
def ... | nrao/nell | scheduler/tests/TestBlackout.py | TestBlackout.py | py | 9,711 | python | en | code | 0 | github-code | 13 |
12641859572 | import numpy as np
#from numba import jit
HEADER_KEY_VAL_SIZE = 80 #bytes
DIRECT_IO_SIZE = 512
HPGUPPI_HDR_SIZE = 5*80*512
HPGUPPI_DATA_SIZE = 128*1024*1024
HPGUPPI_N_BLOCKS = 24
class Dumpfile():
"""
A very basic guppi raw file reader
"""
def __init__(self, fname):
if type(fn... | wfarah/guppi | guppi/dumpfile.py | dumpfile.py | py | 2,377 | python | en | code | 1 | github-code | 13 |
34899519450 | #!/usr/bin/env python3
import argparse
import logging
import os
import select
from systemd import journal
class Exporter:
def __init__(
self,
target_systemd_unit: str,
logger: logging.Logger = None,
log_level: str = "INFO",
systemd_log_level: str = "INFO",
):
# ... | blomquistr/python-node-exporter | exporter/exporter.py | exporter.py | py | 3,374 | python | en | code | 0 | github-code | 13 |
8902576740 | from turtle import Turtle
class Runer(Turtle):
def __init__(self) -> None:
super().__init__()
self.hideturtle()
self.penup()
self.shape("turtle")
self.color("black")
self.setheading(90)
self.goto(0, -280)
self.showturtle()
def run(self):
... | foxtailer/learn | 100day_of_code/TURTLE/turtle_cross/runer.py | runer.py | py | 336 | python | en | code | 0 | github-code | 13 |
40424588352 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Libraries dependancies :
#
# Import peewee ORM.
from peewee import *
# Import Base utils.base (Peewee ORM connector)
from utils.bdd import MyModel
# Importe datetime.datatime and datetime.timedelta
from datetime import datetime, timedelta
# Import logging li... | LounisBou/haroun | core/concepts/Context.py | Context.py | py | 8,145 | python | en | code | 0 | github-code | 13 |
27953288364 | """
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
from __future__ import annotations
import typing
from typing import Literal
import aiohttp
import discord
from disco... | ZiRO-Bot/Z3R0 | src/zibot/exts/nsfw/nsfw.py | nsfw.py | py | 4,611 | python | en | code | 3 | github-code | 13 |
41588476221 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# social login stuff
url('', include('social.apps.django_app.urls', namespace='social')),
url('', include('django.contrib.auth.urls', namespa... | Davidhw/infocatch | rssplus/urls.py | urls.py | py | 634 | python | en | code | 0 | github-code | 13 |
22856042519 | from collections import deque
from itertools import combinations
def find_subarray(data, target):
curr_sum = data[0]
start, idx = 0, 1
size = len(data)
while idx <= size:
while curr_sum > target and start < idx - 1:
curr_sum = curr_sum - data[start]
start += 1
... | brandon-charest/AdventOfCode2020 | Python/Day_09/encoding.py | encoding.py | py | 1,172 | python | en | code | 0 | github-code | 13 |
32276610633 | # exercise 160: Weird Words
import string
def contains_adjacent_e_i(word):
"""
:param word: string
:return: True if the word contains adjacent 'e' and 'i' (e.g. ceiling, scientist, etc.), False otherwise
"""
if 'e' in word and 'i' in word:
for i in range(len(word)):
if i != le... | sara-kassani/1000_Python_example | books/Python Workbook/files_and_exceptions/ex160.py | ex160.py | py | 2,729 | python | en | code | 1 | github-code | 13 |
2680437079 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
def rastrigin_function(x, y):
"""Funkcja celu - Rastrigin"""
return 20 + x**2 - 10 * np.cos(2 * np.pi * x) + y**2 - 10 * np.cos(2 * np.pi * y)
class AntColony:
def __in... | kingasmi/algorytm_mrowkowy | ant2-3d.py | ant2-3d.py | py | 2,922 | python | en | code | 0 | github-code | 13 |
2112188030 |
from south.db import db
from django.db import models
from unidades.models import *
class Migration:
def forwards(self, orm):
# Adding model 'SistemaMedida'
db.create_table('unidades_sistemamedida', (
('id', models.AutoField(primary_key=True)),
('abrev_en', mod... | esw/SapInt | unidades/migrations/0001_initial.py | 0001_initial.py | py | 7,757 | python | es | code | 2 | github-code | 13 |
5452035538 | import re
def railfence_encrypt(text):
result= ""
echr = [] #even position letter list
ochr = [] #odd position letter list
for i in range(len(text)):
if i % 2 == 0:
echr.append(text[i])
else:
ochr.append(text[i])
echr.extend(ochr) #extending o... | shreedhar37/Cryptography | product_cipher.py | product_cipher.py | py | 2,883 | python | en | code | 0 | github-code | 13 |
30121883161 | # -*- coding:utf-8 -*-
import argparse
import glob
import os
import collections
import re
import cPickle as pickle
import logging
from collections import defaultdict
logging.basicConfig(level=logging.INFO)
class ConvertFunctionError(RuntimeError):
pass
def extractFunctions(functions, inputPath):
functionReg... | deepmind/torch-cephes | makewrap/extractFunctions.py | extractFunctions.py | py | 5,357 | python | en | code | 46 | github-code | 13 |
31527946161 | # 导入nltk数据包
import nltk
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
# 导入包
from sklearn.naive_bayes import MultinomialNB
import csv
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classificatio... | wwyys/echarts | echarts/python/朴素贝叶斯。词向量/垃圾信息分类(scdn).py | 垃圾信息分类(scdn).py | py | 3,363 | python | en | code | 0 | github-code | 13 |
1119602241 | #https://www.udemy.com/course/complete-python-developer-zero-to-mastery/learn/lecture/16016662#questions
# for number in range(0, 90, 2):
# print(number)
#
# for i,char in enumerate(list(range(100))):
# print(i, char)
# if char == 50:
# print(f'index of 50 is: {i}')
i = 0
while i < 50:
print(... | tripura-kant/Python-Scripting | ZTM/Day3.py | Day3.py | py | 375 | python | en | code | 0 | github-code | 13 |
23968787729 | import numpy as np
from flask import Flask, request, app, render_template
import numpy as np
import cv2 as cv
import os
import numpy as np
import os
import torch
UPLOAD_FOLDER = './static/uploads'
app = Flask(__name__, template_folder='./templates', static_folder='./static')
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDE... | Rameez0216j/Drowsiness_Detection_application | app.py | app.py | py | 2,661 | python | en | code | 0 | github-code | 13 |
19098230694 | import os
import csv
csvpath = os.path.join('budget_data.csv')
with open(csvpath, newline='') as csvfile:
csvreader = csv.reader(csvfile, delimiter=',')
header=next(csvfile,None)
monthly_change = []
total_months = 0
total_profit = 0
greatest_increase = 0
greatest_decrease = 0
pre... | JKaplan814/UTexas_Python_Homework | PyBank/main.py | main.py | py | 1,803 | python | en | code | 0 | github-code | 13 |
35860185781 | import urllib.parse
import os
import json
print('Loading function')
def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))
# Get the object from the event and show its content type
bucket = event['detail']['requestParameters']['bucketName']
key = urllib.parse.unquot... | PacktPublishing/Data-Engineering-with-AWS | Chapter10/dataeng-check-file-ext.py | dataeng-check-file-ext.py | py | 625 | python | en | code | 239 | github-code | 13 |
13597950222 | import os, qrcode
from qrcode.constants import ERROR_CORRECT_L
class QRCodeGenerator:
def __init__(self, box_size=10, border=1, version=1, error_correction=ERROR_CORRECT_L, fill_color="#000000"):
self.box_size = box_size
self.border = border
self.version = version
self.error_correct... | kWAYTV/qr-code-generator | main.py | main.py | py | 1,575 | python | en | code | 1 | github-code | 13 |
21841958063 | import torch
import deepdish as dd
import numpy as np
from tqdm import tqdm
def checkpoint(
model,
optimizer,
scheduler,
epoch,
curr_step,
save_path,
verbose,
metric_dict={},
tpu=False,
lean=False,
):
save_lib = torch
print_fn = print
if tpu:
import torch_xl... | danielkunin/rethinking-SGD | utils/optimize.py | optimize.py | py | 11,518 | python | en | code | 6 | github-code | 13 |
71817367378 | #!/usr/bin/python
import logging, socket, sys
__NAME__ = "wbRedirector.py"
UDP_IP = "127.0.0.1"
UDP_PORT_SEND = 5005
UDP_PORT_RECV = 5006
sock_send = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock_recv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock_recv.bind((UDP_IP, UDP_PORT_RECV))
logging.basicCon... | dudemcbacon/wbRedirector | wbRedirector.py | wbRedirector.py | py | 1,139 | python | en | code | 0 | github-code | 13 |
2223158791 | import tokenizer
class CompileException(Exception):
def __init__(self, token, message, got=None):
if got:
message += ', got "{}" instead'.format(got.value)
msg = "Error line {} column {}: {}".format(token.line, token.column, message)
super().__init__(msg)
lastToken = None
def p... | snyderdan/D20-Lang | src/compiler/parser.py | parser.py | py | 15,284 | python | en | code | 0 | github-code | 13 |
11369384665 | import re
from pydub import AudioSegment
import aiosqlite
import io
from config import *
from aiogram import Bot, types
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton, Voice
kb_read_zn = ReplyKeyboardMarkup(resize_keyboard=True, one_time_keyboard=True)
button_1 = KeyboardButton(text='За сегодня')
butto... | perep111/KAMAZ-BOT | func.py | func.py | py | 7,210 | python | en | code | 1 | github-code | 13 |
70047463058 | """GUI snake game. It uses external Snake library and pyGame
"""
import sys, pygame, glob
from constants import *
from pygame.locals import *
from snakecore import *
from pygame import Color, display, time, font, draw, Surface, image
class MainUI:
"""The game's user interface class
"""
def __init__(self... | ngkolev/snake | snakegui.py | snakegui.py | py | 14,192 | python | en | code | 0 | github-code | 13 |
4623050367 | import csv
from math import ceil
from tqdm import tqdm
from data_converter import DataConverter
class BKT_converter(DataConverter):
def convert(self):
input_file = open(self.input_file_path, 'rb')
csv_reader = csv.reader(input_file)
header = csv_reader.next()
user_col = self.col_mapping['user_id']
se... | beardeer/assistments_workbench | data_converters/BKT_converter.py | BKT_converter.py | py | 1,612 | python | en | code | 1 | github-code | 13 |
38330060396 | """
Модуль c командами, вызывающимися из интерфейса
"""
import tkinter.messagebox as box
from py.c_commands import create_fib_arr
from py.c_commands import delete_repeated
MAX_INT_FIB_NUM = 47
MAX_INT = 32767
MAX_LEN = MAX_INT
MIN_INT = -(MAX_INT - 1)
def generate(size_entry, res_entry):
"""
Генера... | MyMiDiII/bmstu-c | lab_12_02_2/py/commands.py | commands.py | py | 2,259 | python | ru | code | 3 | github-code | 13 |
219853923 | # n, k = map(int, input().split())
#
# cnt = 0
# for i in range(1, n + 1):
# if(n % i == 0):
# cnt += 1
# if (cnt == k):
# print(i)
# break
# else:
# if(cnt < k):
# print(0)
n, k = map(int, input().split())
arr = []
for i in range(1, n + 1):
if(n % i == 0): a... | ignis535/baekjoon | 코딩테스트 준비/약수 구하기.py | 약수 구하기.py | py | 398 | python | en | code | 0 | github-code | 13 |
19905276427 | class Solution(object):
def fractionToDecimal(self, numerator, denominator):
"""
:type numerator: int
:type denominator: int
:rtype: str
"""
n, remainder = divmod(abs(numerator), abs(denominator))
sign = '-' if denominator * numerator < 0 else ''
if re... | littleliona/leetcode | medium/166.Fraction to recurring decimal.py | 166.Fraction to recurring decimal.py | py | 819 | python | en | code | 0 | github-code | 13 |
22018553976 | # softphone class that uses simple_pj
import random
import re
from time import time, sleep
import lib.logging_esi as logging_esi
from lib.wrappers import Trace
import lib.softphone.simple_pj as pj
from lib.softphone.wav_audio import create_wav_file
from lib.user_exception import UserException as Ux, UserTimeoutExcept... | mccrorey48/mtaf_private | lib/deprecated/softphone2.py | softphone2.py | py | 5,833 | python | en | code | 0 | github-code | 13 |
13092878510 | from __future__ import annotations
from enum import Enum, auto
from typing import TypeVar, Callable, Any, TYPE_CHECKING
from weakref import ReferenceType
CallbackType = TypeVar("CallbackType", Callable[..., Any], Callable[[Any], Any])
if TYPE_CHECKING:
Reference = ReferenceType[CallbackType] # pylint: disable=in... | JiveHelix/pex | python/pex/types.py | types.py | py | 745 | python | en | code | 0 | github-code | 13 |
6005051227 | import requests
import os
from hashlib import md5
from requests.exceptions import RequestException
def download_image(url):
print('正在下载', url)
try:
response = requests.get(url)
if response.status_code == 200:
save_image(response.content)
return None
except RequestExce... | 0217smile/Python-Spider | Spider_Practice/taobao_wangyiyun/save_image_test.py | save_image_test.py | py | 850 | python | en | code | 0 | github-code | 13 |
38832538851 | # Import
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType
from selenium.webdriver.chrome... | luceien/MotusSolver | utils.py | utils.py | py | 7,438 | python | en | code | 0 | github-code | 13 |
30615801942 | import os, re, configparser, requests
import random
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher, FSMContext
from aiogram.utils import executor
from aiogram.utils.helper import Helper, HelperMode, ListItem
from aiogram.dispatcher.filters.state import State, StatesGroup
from aiogram.contrib.f... | grasth/tikTokBot | main.py | main.py | py | 11,137 | python | ru | code | 2 | github-code | 13 |
46286695634 | from diva import Diva
from diva.widgets import *
from diva.utilities import register_simple_util, register_widget_util, file_response
import pandas as pd
import tempfile
# if your utility has options that depend on the currently displayed value,
# of the figure, then use register_widget_util
def my_util_widgets(val)... | mgriley/diva | examples/custom_utility.py | custom_utility.py | py | 1,642 | python | en | code | 45 | github-code | 13 |
30858813959 | from django.urls import path
from movies.views import *
from .views import *
urlpatterns = [
path("login/", giris, name="login"),
path("register/", register, name="register"),
path("profile/", profile, name="user"),
path("logout/", cikis, name="logout"),
path("hesapSil/", hesapSilme, name="hesapSil"... | MervanKoncuk/DjangoNetflix | user/urls.py | urls.py | py | 324 | python | en | code | 0 | github-code | 13 |
12871055545 | """
Problem Statement:
You have an UNDIRECTED, connected graph of n nodes labeled from 0 to n-1. You are given an array
graph where graph[i] is a list of all the nodes connected with node i by an edge.
Return the length of the shortest path that visits every node. You may start and stop at... | Nacriema/Leet-Code | daily_challenges/shortest-path-visiting-all-nodes.py | shortest-path-visiting-all-nodes.py | py | 3,456 | python | en | code | 0 | github-code | 13 |
2927731667 | import numpy as np
from copy import deepcopy as dc
import re
def read_input(filename):
with open(filename) as f:
lines = f.readlines()
lines = [l.replace("\n","").strip() for l in lines]
data = []
pp = dict()
for line in lines:
if line == "":
data.append(dc(pp))
pp = dict()
continue
for field in... | N40/advendofcode_2022 | legacy_2020/day_4/run.py | run.py | py | 2,368 | python | en | code | 0 | github-code | 13 |
72682824977 | from ..modeling.pairwise import ChainCosine, TargetEncoder, ContextEncoderConcat
from ..modeling.aux import mySentenceTransformer
from sklearn.cluster import AgglomerativeClustering
import numpy as np
import torch
from tqdm import tqdm
def _load_pairwise_cat(ckpt_path, device):
context_size = 3
encoder_name =... | voorhs/practicum-fall-2023 | src/mylib/augmentations/prune.py | prune.py | py | 3,080 | python | en | code | 0 | github-code | 13 |
21457780526 | # -*- coding: utf-8 -*-
# This file is part of Argos.
#
# Argos is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Argos is distribut... | leehawk2001/argos | argos/utils/misc.py | misc.py | py | 4,163 | python | en | code | null | github-code | 13 |
22531518044 | from collections import deque
import gym
from matplotlib import pyplot as plt
import numpy as np
import random
import tensorflow as tf
from tensorflow.keras import models, layers, optimizers, Input
from tensorflow.keras import backend as K
from tensorflow.keras import initializers
import time
from memory import Memory
... | ThatDreamer/Multi-camera-perception | DQN/dqn.py | dqn.py | py | 6,339 | python | en | code | 0 | github-code | 13 |
1186039963 | #import shenanigans
import time
import sys
import random
import os
def cls():
os.system('cls' if os.name=='nt' else 'clear')
#pravidla hry
rules = {
"rock": "scissors",
"paper": "rock",
"scissors": "paper",
}
#volby bot
choices_bot = {
"1": "rock",
"2": "paper",
"3": "scissors"
}
#volby hráč
ch... | Thasimo1/Programming-files | RockPaperScissors-hw.py | RockPaperScissors-hw.py | py | 3,140 | python | en | code | 0 | github-code | 13 |
20236786830 | from django.shortcuts import render, redirect
from django.views.generic.base import TemplateView
def error_403(request, exception):
data = {}
return render(request, 'webpage/403.html', data)
def error_404(request, exception):
data = {}
return render(request, 'webpage/404.html', data)
def error_500(request, ex... | Antonio-Neves/Gestao-Escolar | webpage/views.py | views.py | py | 1,027 | python | en | code | 15 | github-code | 13 |
14210129572 | import json
import requests
command = {"command": "move_forward", "distance": 10}
json_command = json.dumps(command)
response = requests.post("http://192.168.197.58:8000/execute_command", data=json_command)
if response.status_code == 200:
print("Command executed successfully")
else:
print("Command execution ... | Mohammed-Rahman-sherif/communication-system | transmitter.py | transmitter.py | py | 329 | python | en | code | 0 | github-code | 13 |
4616995088 | import requests
import pandas
from io import BytesIO
url= "https://dart.fss.or.kr/pdf/download/excel.do?rcp_no=20210817001883&dcm_no=8182806&lang=ko"
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36'}
resp = requests.get(url,h... | siilver94/Dart-Financial-Statement-Data-Collection-and-Analysis | python/src/etc/save-specific-cell.py | save-specific-cell.py | py | 616 | python | en | code | 1 | github-code | 13 |
43351717423 | import sys
from collections import defaultdict
n = int(sys.stdin.readline())
shoes_dict = defaultdict(int)
for i in range(n):
shoes_dict[int(sys.stdin.readline())] += 1
answer = 0
max_stock = 0
for key, value in shoes_dict.items():
if value > max_stock:
max_stock = value
answer = key
e... | W00SUNGLEE/codingmasters | 4319/4319.py | 4319.py | py | 408 | python | en | code | 0 | github-code | 13 |
7954884169 | '''Load all transcripts from the genome file,
select only for ncRNA that are confirmed
and store them in a FASTA file.'''
from Bio.SeqIO import parse
genome_filename = '/home/jlflores/Documents/Aptamer21/Genome/GCF_000001405.38_GRCh38.p12_rna.fna'
all_transcripts = [rna for rna in parse(genome_filename, 'fasta')... | jl-flores/udem-2018-bioinfo | genome-manip/script2_get_ncRNA.py | script2_get_ncRNA.py | py | 1,762 | python | en | code | 0 | github-code | 13 |
2930470087 | # -*- coding:utf-8 -*-
from luma.core.interface.serial import i2c, spi
from luma.core.render import canvas
from luma.core import lib
from luma.oled.device import sh1106
import RPi.GPIO as GPIO
import time
import subprocess
import os
from PIL import Image
from PIL import ImageDraw
from PIL import Imag... | mtulu-argeX/minoroller | bluetoothExample/exampleOled/screenDemo.py | screenDemo.py | py | 1,823 | python | en | code | 4 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.