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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
45386087756 | """
Classes representing uploaded files.
"""
import errno
import os
from io import BytesIO
from theory.conf import settings
from theory.core.files.base import File
from theory.core.files import temp as tempfile
from theory.utils.encoding import forceStr
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUp... | grapemix/theory | theory/core/files/uploadedfile.py | uploadedfile.py | py | 3,916 | python | en | code | 1 | github-code | 6 |
2677444598 | # This code is based on https://github.com/openai/guided-diffusion
"""
Train a diffusion model on images.
"""
import os
import json
from mdm_utils.fixseed import fixseed
from mdm_utils.parser_util import train_args
from mdm_utils import dist_util
from train_utils.train_loop import TrainLoop
from mdm_utils.model_util ... | zyhbili/LivelySpeaker | scripts/train_RAG.py | train_RAG.py | py | 1,624 | python | en | code | 38 | github-code | 6 |
38075843165 | import gc
from collections import defaultdict
import cupy as cp
import pandas as pd
import torch
import torch.nn.functional as F
from cuml.metrics import pairwise_distances
from cuml.neighbors import NearestNeighbors
from torch.utils.data import DataLoader, Dataset, default_collate
from tqdm import tqdm
from transform... | thanhhau097/lecr | dataset.py | dataset.py | py | 35,343 | python | en | code | 0 | github-code | 6 |
369174475 | from typing import Optional
#se verifica daca treeul este symetric
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def isSymmetric(self, root: Optional[TreeNode]) -> bool:
if not root or not ro... | ArdaiArtur/PY | LeetCode/SymetricTree.py | SymetricTree.py | py | 1,405 | python | en | code | 0 | github-code | 6 |
21485666359 | import math
from collections import defaultdict
import heapq
from itertools import permutations
from itertools import combinations
from itertools import combinations_with_replacement
from collections import Counter
import random
def test_case():
n, a, b = list(map(int, input().split()))
arr = list(map(int, input().s... | bboychencan/Algorithm | google/kickstart/roundD2020/c.py | c.py | py | 957 | python | en | code | 0 | github-code | 6 |
70494302589 | import solid as sp
import solid.utils as spu
from frame.materials import tube
from frame.utils import entrypoint
from . import column_mount, instrument_panel, throttle, arm, arm_mount, wheel, wheel_mount
from .dimensions import column_diameter, column_length
def assembly():
column = tube.volume(diameter=column_... | DanNixon/HackyRacer | cad/frame/assembly/steering/assembly.py | assembly.py | py | 1,362 | python | en | code | 0 | github-code | 6 |
4298091636 | """
自动轨迹绘制
"""
import turtle as t
t.title("自动轨迹绘制")
t.setup(800, 600, 0, 0)
t.pencolor("red")
t.pensize(5)
#数据读取
datals = []
f = open("../resources/data.txt", encoding="utf-8")
for line in f:
#去掉当前行末尾的换行符
line = line.replace("\n", "")
#用逗号分隔当前行,并把分割后得到的列表中的每个元素应用eval函数,
# 这里的map就是起到每个元素作为参数传递到前面的函数中去
... | HALF-MAN/pythonlearn | learning/file_and_data_formatting/AutoTraceDraw.py | AutoTraceDraw.py | py | 830 | python | zh | code | 1 | github-code | 6 |
37555301338 | class DjangoModelPermissionsWithRead(DjangoModelPermissions):
perms_map = {
'GET': ['%(app_label)s.view_%(model_name)s'],
'OPTIONS': [],
'HEAD': [],
'POST': ['%(app_label)s.add_%(model_name)s'],
'PUT': [],
'PATCH': [],
'DELETE': ['%(app_label)s.delete_%(model_... | rabar1995/pollisterjango | .history/poll/permissions_20191031152258.py | permissions_20191031152258.py | py | 335 | python | en | code | 0 | github-code | 6 |
13138241281 | from django.contrib import admin
from django.urls import path, include
from django.http import HttpResponse
def homepage(request):
return HttpResponse("you're in the home page, goto polls.")
urlpatterns = [
path('admin/', admin.site.urls),
path('', homepage),
path('polls/', include('polls.urls')),
]... | callmebhawesh/100-Days-Of-Code | Day 31/mysite/mysite/urls.py | urls.py | py | 321 | python | en | code | 3 | github-code | 6 |
71623457467 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 23 11:31:08 2020
@author: dkafkes
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('master_stdev.csv', header = 0, skiprows = list(np.arange(1, 177)))
df.drop(columns = ['Filename'], inplace = True)
df = df.set_ind... | dkafkes/simplified-ai-for-accelerators | data pipeline/histogram.py | histogram.py | py | 577 | python | en | code | 0 | github-code | 6 |
31746854279 | """ This module allows you to download public files from Google Drive and Dropbox """
import os
import requests
import zipfile
import logging
import patoolib
from bs4 import BeautifulSoup
import gdrivedl
# Define urls to filter by cloud service
GDRIVE_URL = 'drive.google.com'
DROPBOX_URL = 'dropbox.com'
def download_... | duckduckgrayduck/clouddl | src/clouddl/clouddl.py | clouddl.py | py | 4,484 | python | en | code | 3 | github-code | 6 |
40107035382 | version = "0.8"
import os, io
import chardet
from functools import wraps
from tempfile import mkstemp, mkdtemp
from json import JSONEncoder as _JSONEncoder
from pathlib import Path
from collections import deque
from colorama import Fore as F
markdown = None
class LabelledTree (object) :
def __init__ (self, lab... | fpom/badass | badass/__init__.py | __init__.py | py | 3,857 | python | en | code | 4 | github-code | 6 |
16737781321 | import pdb
import unittest
import json
from objbrowser import browse
import mock
from mock import patch
import music_server
from music_server import youtube_search
from music_server import config
class YoutubeSearchTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
... | Sun42/music_server | tests/youtube_search_tests.py | youtube_search_tests.py | py | 3,183 | python | en | code | 0 | github-code | 6 |
308791926 | # my_file = open("data.txt")
# contents = my_file.read()
# print(contents)
# my_file.close()
# automaattisesti sulkee tiedoston lopussa
with open("data.txt") as my_file:
contents = my_file.read()
print(contents)
# read on moden default
with open("data.txt", mode="w") as my_file_again:
my_file_again.write(... | satuhyva/100daysOfPython | Day 024/practicing/files.py | files.py | py | 856 | python | en | code | 0 | github-code | 6 |
38592347384 | from .atari import Atari
from .obj3d import Obj3D
from torch.utils.data import DataLoader
from object_detector import CLIPort_Dataset
__all__ = ['get_dataset', 'get_dataloader']
def get_dataset(cfg, mode):
assert mode in ['train', 'val', 'test']
return CLIPort_Dataset(cfg.dataset_roots.TABLE, mode)
def get_... | 1989Ryan/paragon | object_detector/space/dataset/__init__.py | __init__.py | py | 713 | python | en | code | 7 | github-code | 6 |
1104386399 | import random
karakterler= "qwertyuıopasdfghjklzxcvbnmiIQWERTYUOPASDFGHJKLZXCVBNM1234567890é!'^+%&/()=?_-*<>£#$½{[]}"
sifresayisi = int(input("olusturmak istediginiz sifre sayisini giriniz "))
for x in range(sifresayisi):
sifre = ""
for x in range(16):
karakter = random.choice(karakterler)
sifre... | quebec164/pythonodevleri | sifreolusturucu.py | sifreolusturucu.py | py | 384 | python | en | code | 12 | github-code | 6 |
74387397629 | # SOAl 3
# KAMUS
# x, y : int
# ALGORITMA
# membuat fungsi convert
def convert(code, TC):
if code == 'F':
hasil = ((9/5)*TC)+32
elif code == 'R':
hasil = (4/5)*TC
else:
hasil = TC + 273
return f'{hasil} {code}'
# mengingput code dan besar suhu dalam celcius
code = input('kode... | xmriz/kuliah-main | Pengkom-TPB1/08 - Tugas Pengkom/PR/PR1/3.py | 3.py | py | 431 | python | id | code | 0 | github-code | 6 |
18453506476 | from icecream import ic
from stack import Stack
from datetime import datetime
def time_format():
return f'{datetime.now().strftime("%m/%d/%Y, %I:%M:%S")}|> '
ic.configureOutput(prefix=time_format, includeContext=True)
def nextLargestElment(items):
tempStack = Stack()
returnStack = Stack()
tempStac... | beharamadhu270405/python-DS | stack/next_greatest_element_using_stacks.py | next_greatest_element_using_stacks.py | py | 1,594 | python | en | code | 0 | github-code | 6 |
27825918351 | """
создайте асинхронные функции для выполнения запросов к ресурсам (используйте aiohttp)
- доработайте модуль `jsonplaceholder_requests`:
- установите значения в константы `USERS_DATA_URL` и `POSTS_DATA_URL` (ресурсы нужно взять отсюда https://jsonplaceholder.typicode.com/)
- создайте асинхронные функции для в... | MikhailParkin/MikhailParkin | homework_04/jsonplaceholder_requests.py | jsonplaceholder_requests.py | py | 2,013 | python | ru | code | 0 | github-code | 6 |
72946767548 | import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.decomposition import LatentDirichletAllocation
import os
from time import strftime
# Python 3.5
def load_data(filename):
return np.loadtxt(filename, skiprows=1, delimiter=' ')
def save_predictions(X, mod... | bchidamb/AmazonFeels | shit_tier/random_forest_pca.py | random_forest_pca.py | py | 1,890 | python | en | code | 3 | github-code | 6 |
17688731362 | import json
import os
import gui
import wx
import addonHandler
import braille
import config
import controlTypes
import languageHandler
from .common import configDir
addonHandler.initTranslation()
CUR_LANG = languageHandler.getLanguage().split('_')[0]
PATH_JSON = os.path.join(configDir, f"roleLabels-{CUR_LANG}.json"... | aaclause/BrailleExtender | addon/globalPlugins/brailleExtender/rolelabels.py | rolelabels.py | py | 8,877 | python | en | code | 15 | github-code | 6 |
17882061657 | from demisto_sdk.commands.common.constants import CLASSIFIERS_DIR, PACKS_DIR
from demisto_sdk.commands.common.content.objects.pack_objects.abstract_pack_objects.json_content_object import \
JSONContentObject
from demisto_sdk.commands.common.tools import src_root
TEST_DATA = src_root() / 'tests' / 'test_files'
TEST... | AdouniH/demisto-sdk | demisto_sdk/commands/common/content/tests/objects/pack_objects/abstract_pack_objects/json_content_object_test.py | json_content_object_test.py | py | 952 | python | en | code | null | github-code | 6 |
33526673883 | #Faça um programa que ajude um jogador da MEGA SENA a criar palpites.O programa vai perguntar quantos jogos serão gerados e vai sortear 6 números entre 1 e 60 para cada jogo, cadastrando tudo em uma lista composta.
from random import randint
from time import sleep
jogos=int(input("Quantos jogos você deseja? "))
números... | cauavsb/python | mundo-3-py/ex17.py | ex17.py | py | 838 | python | pt | code | 0 | github-code | 6 |
29147426513 | '''-Crear una subrutina llamada “Login”, que recibe un nombre de usuario y una contraseña y te devuelve Verdadero si el nombre de usuario es “admin” y la contraseña es “admin123*”. Además recibe el número de intentos que se ha intentado hacer login y si no se ha podido hacer login incremente este valor.'''
def login(u... | insoul-code/proyectos-python | funciones/reto3.py | reto3.py | py | 648 | python | es | code | 1 | github-code | 6 |
38044932492 | import requests
import uuid
from datetime import datetime
import pandas as pd
# https://kcnew.ifrc.org/api/v1/forms find the kpi asset uid for forms here
#from settings import * #to import MYTOKEN and KPIASSETUID
##################
## RUN SETTINGS ##
##################
##https://kobonew.ifrc.org/token/?format=jso... | aklilu/BachUploadToKobo | bathcuploadtokobo.py | bathcuploadtokobo.py | py | 2,722 | python | en | code | 0 | github-code | 6 |
24285372674 | #! python3
# program to load current weather from api
# via cmd
# display for today and the next two days
# to run: currentWeather location
import json
import requests
import sys
if len(sys.argv) < 2:
print('More argument pls')
sys.exit()
location = ' '.join(sys.argv[1:])
key = ''
# download
url = 'http://api.... | chhatrachhorm/ABS | PythonStuff/JsonApi/currentWeather.py | currentWeather.py | py | 632 | python | en | code | 5 | github-code | 6 |
19827881272 | from flask import Flask, request
import json
import socket
import urllib.request as urllib2
import re
from functools import wraps
application = Flask(__name__)
CONFIG = json.load(open("config.json", "r"))
API_KEYS = CONFIG["api_keys"]
def requires_auth_key(func):
@wraps(func)
def wrapplicationed(*args, **kw... | s0lesurviv0r/graphite_http_relay | main.py | main.py | py | 2,262 | python | en | code | 0 | github-code | 6 |
21988639916 | # update.py
import requests
import json
import tarfile
url = "https://ddragon.leagueoflegends.com/api/versions.json"
response = requests.get(url)
obj = response.json()
patch = str(obj[0])
zipUrl = "https://ddragon.leagueoflegends.com/cdn/dragontail-" + patch + ".tgz"
print(zipUrl)
data = requests.get(zipUrl)
with... | ryanweston/lol-skills | src/assets/update.py | update.py | py | 659 | python | en | code | 0 | github-code | 6 |
72066886907 | import sys, os, re
import unittest
from itertools import product as prod
from timeit import Timer
import time
import math
import logging
import numpy as np
from scipy.optimize import fmin, fmin_bfgs
from hydrodiy.stat.transform import BoxCox2
from hydrodiy.data.containers import Vector
from pygme.model import Mod... | csiro-hydroinformatics/pygme | tests/test_pygme_calibration.py | test_pygme_calibration.py | py | 17,767 | python | en | code | 0 | github-code | 6 |
41603934185 | from unittest import TestCase
import numpy as np
import phi
from phi import math
from phi.math import channel, batch
from phi.math._shape import CHANNEL_DIM, BATCH_DIM, shape_stack, spatial
from phi.math._tensors import TensorStack, CollapsedTensor, wrap, tensor
from phi.math.backend import Backend
BACKENDS = phi.de... | Brian-Hsieh/shapeOptim | phiflow/tests/commit/math/test__tensors.py | test__tensors.py | py | 10,515 | python | en | code | 0 | github-code | 6 |
32094781612 | import sys
sys.stdin = open("input.txt", "r")
from collections import Counter
A = int(input())
B = int(input())
C = int(input())
X = str(A*B*C)
for n in range(0,10):
N = str(n)
if N in Counter(X):
print(Counter(X).get(N))
else:
print(0) | doll2gom/TIL | KDT/week4/01.19/2577.py | 2577.py | py | 267 | python | en | code | 2 | github-code | 6 |
21254950435 | """
La fonction pascal renvoit une liste correspondant au triangle de Pascal de la ligne 1 à la ligne n où
n est un nombre entier supérieur ou égal à 2 (le tableau sera contenu dans la variable C).
La variable Ck doit, quant à elle, contenir, à l’étape numéro k, la k-ième ligne du tableau.
"""
def pascal(n)... | SwordLoveDev/AlgorithmBasicPython | tableauPascal.py | tableauPascal.py | py | 542 | python | fr | code | 3 | github-code | 6 |
27132126928 | import logging
import redis
from rq import Connection, Queue
from agent.agents import get_agent_info
from plugins.patching.os_apps.incoming_updates import \
incoming_packages_from_agent
from plugins.patching.custom_apps.custom_apps import \
add_custom_app_to_agents
from plugins.patching.supported_apps.syncer... | SteelHouseLabs/vFense | tp/src/receiver/rvhandler.py | rvhandler.py | py | 2,924 | python | en | code | 5 | github-code | 6 |
23327135383 | import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import settings
logging.basicConfig(filename='bot.log', level=logging.INFO)
# Настройки прокси. Используем ради интереса
PROXY = {'proxy_url': settings.PROXY_URL,
'urllib3_proxy_kwargs': {'username': settings.PROXY_USERNAME,... | SanuNak/mybot | bot.py | bot.py | py | 1,646 | python | ru | code | 0 | github-code | 6 |
14993235685 | # 引用url模块
from django.conf.urls import url
#导入视图函数
from .views import *
app_name="booktest"
urlpatterns=[
# url('myurl/',myview)
# url(r'^index/$',index),
#
url(r'^$',index,name="index"),
# url(r'^$',indexView.as_view(),name="index"),
# url(r'^$',indexTemplateView.as_view(),name="index"),
... | pan0527/chenpan | demo1/booktest/urls.py | urls.py | py | 712 | python | en | code | 0 | github-code | 6 |
22757452562 | # stdlib
import unittest
# project
from stackstate_checks.splunk.config import AuthType, SplunkInstanceConfig
from stackstate_checks.base.errors import CheckException
mock_defaults = {
'default_request_timeout_seconds': 5,
'default_search_max_retry_count': 3,
'default_search_seconds_between_retries': 1,
... | StackVista/stackstate-agent-integrations | splunk_base/tests/test_splunk_instance_config.py | test_splunk_instance_config.py | py | 5,203 | python | en | code | 1 | github-code | 6 |
74795559226 | from django.db import models
from Pages.models import Page
import urllib
from .special_character_table import TABLE
def get_report_url(post_hashtag):
return "http://c8763.webutu.com?hashtag="+str(post_hashtag)
# Create your models here.
class Record(models.Model):
submit_type=models.IntegerField(default=0)
... | austin880625/KSKGcomplain | Submissions/models.py | models.py | py | 2,572 | python | en | code | 1 | github-code | 6 |
32188022347 | from itertools import permutations
def primenumber(x):
if x < 2:
return False
for i in range(2, x):
if x % i == 0:
return False
return True
def solution(numbers):
answer = 0
num = []
for i in range(1, len(numbers)+1) :
num.append(list(set(map(''.join, pe... | kcw0331/python-for-coding-test | programmers-coding/소수찾기.py | 소수찾기.py | py | 1,183 | python | en | code | 0 | github-code | 6 |
73652386109 | # 给定一个包含 [0, n] 中 n 个数的数组 nums ,找出 [0, n] 这个范围内没有出现在数组中的那个数
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums = nums + [len(nums) + 1] * 2
for i in range(len(nums) - 1):
nums[abs(nums[i])] = -abs(nums[ab... | xxxxlc/leetcode | array/missingNumber.py | missingNumber.py | py | 642 | python | en | code | 0 | github-code | 6 |
41933031591 | import pyautogui
import time
pyautogui.moveTo(3530, 983) # Lokasi kursor kearah chat
pyautogui.click()
# Spam chat 100 pesan.
for i in range(100):
pyautogui.write("PING!!!") # Message pesan spam
time.sleep(0.01) # Waktu jeda spam
pyautogui.press("Enter") | arvandha121/SPAM_CHAT_WHATSAPP | spam.py | spam.py | py | 268 | python | en | code | 0 | github-code | 6 |
15018796065 | from View.GUI.Windows.ParameterWindow.ComponentSections.AbstractParameterSection import AbstractParameterSection
from View.GUI.Windows.ParameterWindow.ComponentSections.TkParameterSection import TkParameterSection
class EdgeParameterSection(AbstractParameterSection):
def __init__(self, root, edge, controller):
... | Moni5656/npba | View/GUI/Windows/ParameterWindow/ComponentSections/EdgeParameterSection.py | EdgeParameterSection.py | py | 933 | python | en | code | 0 | github-code | 6 |
23777296235 | import numpy as np
import tensorflow as tf
from models import vgg
class network():
def __init__(self, batch_size=1):
self._batch_size = None
self.x = tf.placeholder(dtype=tf.float32, shape=[self._batch_size, None, None, 3], name="input_image")
self.cls_plc = tf.placeholder(tf.float32, sh... | anandhupvr/rpn-tf | models/net.py | net.py | py | 2,694 | python | en | code | 1 | github-code | 6 |
23896439023 | # repeat_bot.py
from bot.common import verify_user, job_name
from dotenv import load_dotenv
from bot.messages import account_summary
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes
from data_model import BotConfig
from utils import load_config
load_dotenv()
class Pos... | KD6-Dash-37/telegram-chat-bot | bot/repeat_bot.py | repeat_bot.py | py | 4,481 | python | en | code | 0 | github-code | 6 |
1715742701 | from __future__ import print_function
import os
import sys
from py2gcode import gcode_cmd
from py2gcode import cnc_dxf
feedrate = 0.4*0.10
depth_per_360 = 0.4*0.03
zero_pos = {'x': 0.0, 'y': 0.0, 'z': 0.0, 'a': 0.0}
start_pos = {'x': 0.0, 'y': 0.0, 'z': 0.0, 'a': 0.0}
final_pos = {'x': 0.0, 'y': 0.0, 'z': -0.6}
#st... | willdickson/sphere_w_rotary_axis | sphere.py | sphere.py | py | 1,227 | python | en | code | 0 | github-code | 6 |
3516700430 | #********************* BGINFO_MULTI ***************************
# Desenvolvido por Frederico de Jesus Almeida
# Analista de Suporte PLENO - Multi
#******************* 06/06/2023 ****************************
import os
import re
import psutil
import socket
import subprocess
import tkinter as tk
... | Frederico02/info-sistema | main_final.py | main_final.py | py | 4,077 | python | pt | code | 1 | github-code | 6 |
5753443462 | # O(n) Time, O(n) Space :-
# def findDuplicate(List):
# myDict = {}
# for _ in List:
# if _ in myDict:
# myDict[_]+=1
# else:
# myDict[_] = 1
# for ele in myDict:
# if myDict[ele]>1:
# return ele
# O(n) Time, O(n) Space : Floyd's Algo
def findD... | Abhrajyoti00/Data-Structures-and-Algorithms | 450 Questions for DSA/Array/11_Find_the_Duplicate_Number.py | 11_Find_the_Duplicate_Number.py | py | 663 | python | en | code | 3 | github-code | 6 |
70766850107 |
from fastapi import APIRouter, Depends
from app.model.param import (
ListTaskParams,
NewTasksListParams,
StopTaskParams,
)
from app.model.response import (
NewTasksResp,
ListTasksResp,
StopTasksResp,
)
from exception import DataExistsError, APIBaseError
from app.model.data import TaskModel, St... | ZSAIm/VideoCrawlerEngine | app/taskflow/routers/task.py | task.py | py | 1,962 | python | en | code | 420 | github-code | 6 |
33188473740 | # -*-coding:utf-8-*-
import logging
from datetime import datetime
class MyLogger():
def __init__(self, name):
self.logger = logging.getLogger(name)
self.handler = logging.FileHandler(filename='logging/%s.log' % name)
self.logger.addHandler(self.handler)
def warning(self, info):
... | xxxx-hhhh/spider | baojianhui_spider/my_logging.py | my_logging.py | py | 546 | python | en | code | 0 | github-code | 6 |
8660192902 | import nltk
nltk.download('stopwords')
nltk.download('punkt')
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
#global set of stopwords
english_stopwords = set(stopwords.words('english'))
def tokenizeText(content):
global english_stopwords
#returns a list of tokens fou... | daveA420/ics121Crawler | newParser.py | newParser.py | py | 857 | python | en | code | 0 | github-code | 6 |
30804216456 | import sys,tty,termios
class _Getch:
def __call__(self):
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(3)
finally:
termios.tcsetattr(fd, termios.TCSA... | AAmir007-code/Game-2048 | keyboard.py | keyboard.py | py | 817 | python | en | code | 5 | github-code | 6 |
72469437949 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 13:00:31 2023
@author: samir
"""
import pandas as pd
dat = pd.read_csv('School Data.csv')
print("PART ONE++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
print('Shape',dat.shape)
'''
for c in dat.columns:
print( c, dat[c].isnull().... | samir-strasser/IFT511_Project_27 | DataCleaning.py | DataCleaning.py | py | 5,356 | python | en | code | 0 | github-code | 6 |
16256206871 | __author__ = 'harrigan'
import mcmd
import glob
class WriteDirectoryListing(mcmd.Parsable):
"""List files and write them in a directory.
:param out_fn: Where to write the file
:param glob_str: How to glob files
:param limit: Max number of files or -1 for all
"""
def __init__(self, out_fn, ... | mpharrigan/mcmd | mcmd/test_mcmd.py | test_mcmd.py | py | 1,038 | python | en | code | 0 | github-code | 6 |
70315957309 | """
bony_downloader.py
module contains BonyDownloader class to provide provider specific functionality
"""
__author__ = 'Dattatraya Tembare<tembare.datta@gmail.com>'
import datetime
import itertools
import lxml.html
import requests
from common.download_exceptions import DownloadException
from download.file_... | dattatembare/file_downloader | src/download/bony_downloader.py | bony_downloader.py | py | 10,730 | python | en | code | 0 | github-code | 6 |
38200306892 | import turtle
star = turtle.Turtle()
star.color('red', 'yellow')
star.begin_fill()
while True:
star.forward(200)
star.left(170)
if abs(star.pos()) < 1:
break
star.end_fill()
star.done()
| Priyanshu360-cpu/Machine-Learning | turtlestar.py | turtlestar.py | py | 206 | python | en | code | 3 | github-code | 6 |
24229213542 | import sys, os,shutil
import traceback
import util
new_pro_1000_info_python_list= util.load_json(util.data_root, "python3_star_10000_repos_info")
print("num of python3: ",len(new_pro_1000_info_python_list))
dict_repo_file_python = util.load_json(util.data_root, "python3_1000repos_files_info")
print("num of python3: ",l... | anonymousdouble/Deidiom | code/remov_non_python3_pro.py | remov_non_python3_pro.py | py | 1,738 | python | en | code | 0 | github-code | 6 |
17534446407 | from functools import reduce
from typing import List
from project.caretaker import Caretaker
from project.cheetah import Cheetah
from project.keeper import Keeper
from project.lion import Lion
from project.tiger import Tiger
from project.vet import Vet
from project.animal import Animal
from project.worker import Wor... | emilynaydenova/SoftUni-Python-Web-Development | Python-OOP-Oct2023/Exercises/04.Encapsulation/wild_cat_zoo/project/zoo.py | zoo.py | py | 4,687 | python | en | code | 0 | github-code | 6 |
810990786 | '''Time Based Key-Value Store - https://leetcode.com/problems/time-based-key-value-store/
Design a time-based key-value data structure that can store multiple values for the same key at
different time stamps and retrieve the key's value at a certain timestamp.
Implement the TimeMap class:
TimeMap() Initializes the o... | Saima-Chaity/Leetcode | Google/Time Based Key-Value Store.py | Time Based Key-Value Store.py | py | 3,635 | python | en | code | 0 | github-code | 6 |
30170732214 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from PyPDF2 import PdfWriter, PdfReader
import io
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib import pagesizes
# ======== Plotting Util ======... | vexplained/JugendForscht2022 | programming/python-analysis/plotting_util.py | plotting_util.py | py | 4,641 | python | en | code | 0 | github-code | 6 |
14539790458 | class Solution:
import copy
def minimumTotal(self, triangle):
"""
:type triangle: List[List[int]]
:rtype: int
"""
#################################超时##################################
# def MinSum(x,y):
#
# if x == len(triangle):
# ... | Rainphix/LeetCode | 120_triangle.py | 120_triangle.py | py | 1,267 | python | en | code | 0 | github-code | 6 |
15653063144 | from aiogram import Bot, types, Dispatcher, executor
import logging
from config import TOKEN, html
import parser as ps
import time
import random
import os
import qrcode
def make_qr(text):
qr = qrcode.QRCode()
qr.add_data(text)
img_qr = qr.make_image(fill_color='white', back_color="black")
img_qr.save('... | sarenis/tg_parsing_bot | bot.py | bot.py | py | 1,329 | python | en | code | 0 | github-code | 6 |
4524699811 | import pytest
import requests
from budget.enums import ExpensesCategoryEnum, IncomeCategoryEnum
from common.tests_fixtures.fixtures import admin_credentials, admin_id, base_url
budgets_url = f"{base_url}/budgets/"
incomes_url = f"{base_url}/incomes/"
expenses_url = f"{base_url}/expenses/"
@pytest.fixture
def create... | MaciejChalusiak/FamilyBudget | budget/tests.py | tests.py | py | 3,755 | python | en | code | 0 | github-code | 6 |
36650794154 | from pywrap.exporter import (MethodDefinition, SetterDefinition,
GetterDefinition, ConstructorDefinition,
FunctionDefinition, CythonDeclarationExporter)
from pywrap.ast import (Param, Function, Clazz, Constructor, Method,
Field, Enum, Typ... | AlexanderFabisch/cythonwrapper | pywrap/test/test_exporter.py | test_exporter.py | py | 6,972 | python | en | code | 37 | github-code | 6 |
73562100029 | from Fiat.DB.mysql import mysql
from Fiat.Base.Host import BaseHost
from Fiat.Core.Utils import loggable
class westhost(BaseHost):
def __init__(self, Instance, dict):
self.config = {
"westhost_username": dict["username"],
"ssh_user": "username",
"ssh_host": "hostna... | iandennismiller/fiat | lib/Fiat/Host/westhost.py | westhost.py | py | 566 | python | en | code | 0 | github-code | 6 |
23284310692 | from pyes.base import clock, elapsed_time, start_time, time_unit
from functools import reduce
import sys
class stats:
"""Class statistics"""
def __init__(self):
"""Class statistics c-tor"""
# Number of calls
self.__count = 0
# Current number of agents
self.__size = 0
# Mainimal number of ... | mdjogatovic/pyes | pyes/stats.py | stats.py | py | 4,351 | python | en | code | 0 | github-code | 6 |
29214466760 | from celery import shared_task, Celery
from django.utils import timezone
from .models import Post
app = Celery()
@shared_task
def publish_posts_task():
posts = Post.objects.filter(
status=False, published_date__lte=timezone.now()
)
for post in posts:
post.status = True
post.save... | smz6990/DRF-Blog | core/blog/tasks.py | tasks.py | py | 665 | python | en | code | 2 | github-code | 6 |
2441674100 | from flask import Flask, render_template, request
from pymysql import connections
import os
import boto3
from config import *
from datetime import date
from botocore.exceptions import ClientError
app = Flask(__name__)
bucket = custombucket
region = customregion
db_conn = connections.Connection(
host=customhost,
... | Darkless123/aws-live | EmpApp.py | EmpApp.py | py | 10,617 | python | en | code | 0 | github-code | 6 |
21138667122 | #!/usr/bin/python3
# -*-coding:utf-8 -*-
# Reference:**********************************************
# @Time : 2019/11/1 23:30
# @Author : Raymond Luo
# @File : train_emb.py
# @User : luoli
# @Software: PyCharm
# Reference:**********************************************
import pickle
from gensim.models impo... | RManLuo/MotifGNN | src_sjjy/train_emb.py | train_emb.py | py | 2,114 | python | en | code | 7 | github-code | 6 |
40205545759 | # encoding: utf-8
"""
CalculationModule.py
Author: Dario Marroquin 18269 (dariomarroquin)
Author: Pablo Ruiz 18259 (PingMaster99)
Version 1.0
Updated March 4, 2021
Required functions for the op amp calculator
"""
from sympy import *
import DatabaseConnection as Db
x = sym... | PingMaster99/MNOpampCalculator | CalculationsModule.py | CalculationsModule.py | py | 11,929 | python | en | code | 0 | github-code | 6 |
29643231166 | import math
import os
import random
import re
import sys
def breakingRecords(scores):
lowestScore = sys.maxsize
highestScore = -1
countMin = -1
countMax = -1
for i in scores:
if i > highestScore:
highestScore = i
countMax += 1
if i < lowestScore:
... | Paradiddle131/Hackerrank | Python/ProblemSolving/Easy/BreakingTheRecords.py | BreakingTheRecords.py | py | 451 | python | en | code | 0 | github-code | 6 |
18480731961 | #!/usr/bin/env python
# coding=utf-8
import datetime
import hashlib
import json
class LastUpdated():
def __init__(self, file='last-updated.json'):
self.file = file
def read(self):
with open(self.file, 'r') as f:
data = json.load(f)
return {
'amiibo_sha1': dat... | N3evin/AmiiboAPI | last_updated.py | last_updated.py | py | 2,178 | python | en | code | 459 | github-code | 6 |
31569881800 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from corai_util.tools.src.function_file import is_empty_file
from data_input.json.parameter_loader import fetch_param_json_loader_simulation, fetch_param_json_loader_itideep
from root_dir import linker_path_to_result_fi... | Code-Cornelius/ITiDeEP | mse/estimation_MSE_plot.py | estimation_MSE_plot.py | py | 6,145 | python | en | code | 0 | github-code | 6 |
31988903167 | import numpy as np
from util import *
import sys
def dunn(X: np.array, labels: np.array):
ks = np.unique(labels)
k_list = [X[labels == k] for k in ks]
deltas = np.ones([len(k_list), len(k_list)]) * 1000000
big_deltas = np.zeros([len(k_list), 1])
l_range = list(range(0, len(k_list)))
for k in... | fedix/ensemble_clustering | metrics.py | metrics.py | py | 2,396 | python | en | code | 1 | github-code | 6 |
31209257710 | import uuid
from random import randint
from src.infratructure.json_parser import JsonParser
from src.infratructure.serializable_object import SerializableObject
class PersonModel(SerializableObject):
def __init__(self, id: int, nick: str, photo: str, name: str = None):
self.id = id
self.nick = ni... | GDGPetropolis/backend-event-checkin | src/application/models/person_model.py | person_model.py | py | 978 | python | en | code | 0 | github-code | 6 |
6966794859 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from kazoo.client import KazooClient
__name__ = "weichigong"
__version__ = '1.0.3'
__author__ = 'dashixiong'
__author_email__ = 'dashixiong.lee@gmail.com'
class zconfig:
def __init__(self, zkHosts, app, env):
self.app = app
self.env = env
... | perfeelab/weichigong | weichigong/__init__.py | __init__.py | py | 764 | python | en | code | 0 | github-code | 6 |
6942571337 | from otree.api import *
from settings import SESSION_CONFIGS
doc = """
Your app description
"""
class Constants(BaseConstants):
name_in_url = 'Intro'
players_per_group = None
num_rounds = 1
max_payoff = "£2.20"
money = "£3.00"
total_balls = "five"
no_task_balls = "three"
# create a ... | LiamOFoghlu/Receiver | Intro/__init__.py | __init__.py | py | 5,072 | python | en | code | 0 | github-code | 6 |
31969871422 | from django.contrib.auth import get_user_model
from django.db import transaction
from django.db.models import Q
from rest_framework import serializers
from rest_framework.exceptions import ValidationError, NotFound
from rest_framework.generics import get_object_or_404
from versatileimagefield.serializers import Vers... | seefat/harvest_hub_apis | core/rest/serializers/me.py | me.py | py | 928 | python | en | code | 0 | github-code | 6 |
51224431 | from typing import *
class Solution:
def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
def w2i(w):
return ''.join(str(i) for i in map(lambda x: w.index(x), w))
p = w2i(pattern)
res = []
for w in words:
w_i = w2i(w)
... | code-cp/leetcode | solutions/890/main.py | main.py | py | 576 | python | en | code | 0 | github-code | 6 |
30818901121 | # Created by Andrew Davison
# Instructions to run unittest: Run main conditional at end of file
import unittest
from incident_app import calculations as calc
class TestCalculations(unittest.TestCase):
def test_calculate_average_force(self):
measurements = [30.2, 30.5, 30.4, 30.2, 30.3]
... | wrosoff4/software_engineering_capstone | tests/unit/calculations_test.py | calculations_test.py | py | 4,892 | python | en | code | 0 | github-code | 6 |
10721383879 | import os, time, ctypes, sys, winreg
os.system("title wineditor ^| www.milu.cf")
os.system('mode con lines=17 cols=78')
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
# ---------- defender options ----------
def def... | milu-zzz/wineditor | wineditor.py | wineditor.py | py | 18,286 | python | en | code | 0 | github-code | 6 |
3977236501 | #!/usr/bin/env python3
from ddpg import Agent
import numpy as np
from ts_forecasting_env import ts_forecasting_env
import time
import matplotlib.pyplot as plt
import csv
import pandas as pd
from sklearn.metrics import r2_score, mean_absolute_error, mean_squared_error
import argparse
from ray import tune
from ray.tune.... | tiagomateus25/time-series-forecasting-ddpg | bvg_optimization.py | bvg_optimization.py | py | 4,277 | python | en | code | 0 | github-code | 6 |
33380975525 | from oregami.reg_utils import *
from oregami.reg_type import rf_settype, get_type_from_user
from oregami.reg_frame import RegFrame
import ida_offset
class OffRegPlugin(idaapi.plugin_t):
flags = idaapi.PLUGIN_PROC
comment = "OffReg"
help = "Set offset for regs in their usage frame - only when " \
... | shemesh999/oregami | offreg_plugin.py | offreg_plugin.py | py | 2,515 | python | en | code | 183 | github-code | 6 |
72340854587 | import os
import csv
import json
import tweepy
import numpy as np
import pandas as pd
from datetime import datetime, timedelta
from tweepy_auth import tweepy_auth
'''
today = datetime.today()
week_ago = today - timedelta(days=7)
week_ago_str = week_ago.strftime('%Y-%m-%d')
'''
auth = tweepy_auth()
api = tweepy.API(a... | ConwayHsieh/BLM_tweets | tweepy_pandastry.py | tweepy_pandastry.py | py | 1,444 | python | en | code | 0 | github-code | 6 |
31286775508 | import os
import sys
from datetime import datetime
from argparse import ArgumentParser, ArgumentTypeError
from subprocess import check_output, CalledProcessError, Popen, PIPE, DEVNULL
from contextlib import contextmanager
class FileExistsException(Exception):
def __init__(self, path):
self.path = path
d... | Rainymood/rainymood.github.io | main.py | main.py | py | 4,987 | python | en | code | 8 | github-code | 6 |
73823074747 | class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def isValidBST(root):
def check(root, mini, maxi):
if not root:
return True
if root.val <= mini or root.val >= maxi:
return Fals... | jateen67/leetcode | trees/medium/98_validate_binary_tree.py | 98_validate_binary_tree.py | py | 650 | python | en | code | 0 | github-code | 6 |
73535540349 | from django.urls import path
from . import views
app_name = 'party'
urlpatterns = [
#party
# Party URLs
path('create/<int:tournament_pk>/', views.PartyCreateView.as_view(), name='party_create'),
path('update/<int:pk>/', views.PartyUpdateView.as_view(), name='party_update'),
path('details/<int:... | theAcer/wejprod | apps/party/urls.py | urls.py | py | 942 | python | en | code | 0 | github-code | 6 |
36248300326 | class Node:
def __init__(self,val=None):
self.val = val
self.next = None
self.prev = None
def printl(head):
while head!=None:
print(head.val,end="--->")
head=head.next
print("NULL")
def reverse(head):
if head==None or head.next==None:
return head
els... | Si2-9harth/DSA-Practice-Problems | linked_list/reverse_dll.py | reverse_dll.py | py | 660 | python | en | code | 0 | github-code | 6 |
26043166506 | from __future__ import annotations
import logging
import os
from dataclasses import dataclass
from pathlib import PurePath
from typing import Iterable
from pants.engine.engine_aware import EngineAwareParameter
from pants.engine.fs import (
AddPrefix,
CreateDigest,
Digest,
Directory,
FileContent,
... | pantsbuild/pants | src/python/pants/jvm/shading/rules.py | rules.py | py | 5,649 | python | en | code | 2,896 | github-code | 6 |
13448002846 | #!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
from study_pkg.msg import Control
msg = Control()
msg.steer = 40
msg.speed = 10
rospy.init_node('talker2')
pub = rospy.Publisher('my_chat_topic2', Control, queue_size=10)
rate = rospy.Rate(1)
def topic_cb(msg):
rospy.loginfo('Speed: %d / Steer: %d' ... | ashenone23/study_pkg | scripts/talker2.py | talker2.py | py | 465 | python | en | code | 0 | github-code | 6 |
30396062752 | #https://www.codingame.com/training/medium/gravity-tumbler
#GRAVITY TUMBLER
import re
import numpy as np
w,h=map(int,input().split())
count=int(input())
m=[]
for i in range(h):
r=''.join(re.findall(r"#+",input()))
m+=[list(r+(w-len(r))*".")]
#Use numpy to rotate the 2D matrix
arr=np.array(m)
for i in range(coun... | AllanccWang/CodingGame | classic puzzle-medium/gravity-tumbler.py | gravity-tumbler.py | py | 421 | python | en | code | 1 | github-code | 6 |
71477059068 | import sys
input = sys.stdin.readline
# 첫줄에 도시의 수
n = int(input())
# 여행 계획에 속한 도시의 수 m
m = int(input())
data = [list(map(int, input().split())) for _ in range(n)]
plans = list(map(int, input().split()))
for i in range(n):
for j in range(n):
for k in range(n):
if data[j][i] and data[i][k]:
... | YOONJAHYUN/Python | BOJ/1976.py | 1976.py | py | 601 | python | ko | code | 2 | github-code | 6 |
7789722347 | from tqdm import tqdm
import numpy as np
import torch
import torchvision.transforms as ttr
from torch.utils.data import DataLoader
import argparse
from aermanager import AERFolderDataset
from test_spiking import test_spiking
# Parameters
BATCH_SIZE = 256
parser = argparse.ArgumentParser()
parser.add_argument('--qua... | fgr1986/synoploss | mnist_dvs/optimization_benchmarking.py | optimization_benchmarking.py | py | 2,996 | python | en | code | 0 | github-code | 6 |
26213379014 | import time
import numpy as np
from scipy.sparse import csr_matrix
from scipy.special import expit
from tqdm import tqdm
from hw1.base import FactorizationModel
from hw1.utils import log_iter
class BPRModel(FactorizationModel):
def __init__(self, factors: int, lr: float, iterations: int, lambd: float = 0.,
... | Sushentsev/recommendation-systems | hw1/models/bpr_model.py | bpr_model.py | py | 2,367 | python | en | code | 0 | github-code | 6 |
37564490314 | import pdb
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
from scipy.stats import entropy, gaussian_kde, normaltest
import nflows
from nflows import distributions, transforms, utils, flows
from nflows.transforms.normalization import BatchNor... | nwaftp23/nflows_epistemic | nflows_utils.py | nflows_utils.py | py | 7,615 | python | en | code | 1 | github-code | 6 |
37076072504 | import subprocess
import time
import os
import stat
import threading
import uuid
class Iperf3(object):
def __init__(self, _ssh_machine1,
_ssh_key1,
_ssh_machine2,
_ssh_key2):
self.ssh_machine1 = _ssh_machine1
self.ssh_machine2 = _ssh_machine2
... | phvalguima/iperf-testing | iperf.py | iperf.py | py | 6,642 | python | en | code | 0 | github-code | 6 |
26079699510 | #Perulangan For
#for nilai in sequence:
# blok code
#Contoh 1
for i in "mizard":
print(i)
#Contoh 2 Menggunakan fungsi range()
for i in range(10): #Start(dimulai dari 0 dan berhenti diangka sebelum angka terakhir)
print(i)
for i in range(2,11): #Stop(berhenti diangka sebelumnya angka terakhir)
print(i... | zantblue/Algoritma-Pemograman-Praktek | Python4.py | Python4.py | py | 1,362 | python | id | code | 0 | github-code | 6 |
14490773282 | """
create model
Creator: Xiaoshui Huang
Date: 2020-06-19
"""
from se_math.so3 import inverse, transform
import torch
import numpy as np
from random import sample
import se_math.se3 as se3
import se_math.invmat as invmat
import igl
import os
import sys
sys.path.append('./../')
sys.path.append('./../../')
from loss i... | Dengzhi-USTC/A-robust-registration-loss | code/exps_deep_learning/fmr/model.py | model.py | py | 36,481 | python | en | code | 25 | github-code | 6 |
39267295276 | import sys
import multiprocessing
from controls import ManualControl
from cam import Camera
from server import get_command_keyboard, stream_frame, get_command
import threading
# Klavye ile hareket için mode = 1
# Sesli komut ile hareket için mode = 2
# Klavye ile hareket ve Aynı anda Raspberryden PC'ye frame aktarma i... | AbdullahTas123/pi-robot-car | raspberrypi/main.py | main.py | py | 3,394 | python | en | code | 1 | github-code | 6 |
41550373604 | from . animation import Animation
class Off(Animation):
"""A trivial animation that turns all pixels in a layout off."""
def __init__(self, layout, timeout=1, **kwds):
super().__init__(layout, **kwds)
self.internal_delay = timeout
def step(self, amt=1):
self.layout.all_off()
fr... | ManiacalLabs/BiblioPixel | bibliopixel/animation/off.py | off.py | py | 412 | python | en | code | 263 | github-code | 6 |
70096824829 | k = int(input())
def mos(n):
for i in range(len(n)):
if n[i] == "0":
n += "1"
elif n[i] == "1":
n += "0"
if len(n) == k:
return n[k - 1]
return mos(n)
print(mos("0"))
| YooGunWook/coding_test | 백준/백준_18222번.py | 백준_18222번.py | py | 239 | python | en | code | 0 | github-code | 6 |
22386235362 | from sports.nba.nba_team import NBA_Team
class PortlandTrailBlazers(NBA_Team):
"""
NBA's Portland TrailBlazers Static Information
"""
full_name = "Portland TrailBlazers"
name = "TrailBlazers"
team_id = 1610612757
def __init__(self):
"""
"""
super().__init__()
| FBB-David/sportsdata | src/sportsdata/nba/teams/portland_trail_blazers.py | portland_trail_blazers.py | py | 317 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.