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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
28924494811 | """
Programmers level2.
기능개발 - 처음이랑 마지막 케이스 유의하기
"""
import math
def solution(progresses, speeds):
#local maximum 뽑는 문제(이전게 크다면 그걸 그대로 가져감)
#global maximum이 나타날때까지 계속 늘림
durations = []
for progress, speed in zip(progresses, speeds):
duration = math.ceil((100-progress)/speed)
durations.... | GuSangmo/BOJ_practice | programmers/level2/기능개발.py | 기능개발.py | py | 1,075 | python | ko | code | 0 | github-code | 36 |
4552086130 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: stdrickforce (Tengyuan Fan)
# Email: <stdrickforce@gmail.com> <fantengyuan@baixing.com>
MIND = 123123
def guess(x):
if MIND > x:
return 1
elif MIND < x:
return -1
return 0
class Solution(object):
def guessNumber(self, n):
... | terencefan/leetcode | python/374.py | 374.py | py | 717 | python | en | code | 1 | github-code | 36 |
7037686473 | import sys
import os.path
infile = sys.argv[1]
outfile = sys.argv[2]
if os.path.exists(infile)==True:
with open(outfile,"w") as outfileh, open(infile,"r") as infileh:
lines = infileh.readlines()
for line in lines:
if "noname." not in line:
outfileh.write(line.replace("\... | Cemetech/TI-DCC | tools/replace.py | replace.py | py | 340 | python | en | code | 2 | github-code | 36 |
34754531806 | #Import os module
import os
def create_dir(dirname):
#Check the directory name exist or not
if os.path.isdir(dirname) == False:
#Create the directory
os.mkdir(dirname)
#Print success message
print("The directory is created.")
else:
#Print the message if th... | Amalziad1/python-task1 | part2.py | part2.py | py | 1,670 | python | en | code | 0 | github-code | 36 |
42432458928 | from django.shortcuts import get_object_or_404
from django.contrib.auth import authenticate
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from django.db.models import Q
from uuid import uuid4
from rest_framework import serializers, exceptions, validators
from rest... | IslombekOrifov/olx | src/api/v1/accounts/serializers.py | serializers.py | py | 3,579 | python | en | code | 0 | github-code | 36 |
72595178664 | # ! ! !
# ESSA points no working
# ! ! !
import re
import os
import sys
import Cython
import ctypes
from ctypes import cdll, CDLL
import random
import datetime
import asyncio
import json
from difflib import SequenceMatcher
import nextcord as discord
from nextcord import ActivityType, guild
fr... | Czuowuek-SOS/Bot | Main.py | Main.py | py | 14,480 | python | en | code | 0 | github-code | 36 |
26009605425 | import datetime
import os
import subprocess
import time
import dimacs
start = time.time()
solved = 0
hardest = {}
try:
for file in dimacs.satlib_problems:
file = os.path.join("C:\\satlib", file)
print(file)
dimacs.print_header(file)
expected = dimacs.get_expected(file)
cm... | russellw/ayane | script/batch_dimacs.py | batch_dimacs.py | py | 1,303 | python | en | code | 0 | github-code | 36 |
16538220342 | """
Functionality for working with plasma density data created by the
NURD algorithm
See Zhelavskaya et al., 2016, doi:10.1002/2015JA022132
"""
import os
import glob
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from spacepy import pycdf
def read_cdf(filename, \
pathname='/User... | mariaspasojevic/PyRBSP | nurdpy.py | nurdpy.py | py | 5,014 | python | en | code | 0 | github-code | 36 |
32967621302 | from arcana_app.models import Truck
from twilio.rest import Client
from datetime import date, timedelta
def my_scheduled_job():
'''
Background task with interval set in settings. Function send SMS when is information that MOT expires.
Function sends message one time when 20 days left to mot expiration.
... | KamilNurzynski/Arcana | arcana_app/cron.py | cron.py | py | 848 | python | en | code | 1 | github-code | 36 |
24033649786 | #
# Example file for working with Calendars
#
# import the calendar module
import calendar
# create a plain text calendar
c = calendar.TextCalendar(calendar.SUNDAY)
# st = c.formatmonth(2017, 1, 0, 0)
# print(st)
# create an HTML formatted calendar
hc = calendar.HTMLCalendar(calendar.SUNDAY)
# st = hc.formatmonth(20... | ygchan/Python | A09_Calendars.py | A09_Calendars.py | py | 1,627 | python | en | code | 1 | github-code | 36 |
22021430323 | #Write your function here
def divisible_by_ten(nums):
divisible = []
for number in nums:
if number % 10 == 0:
divisible.append(number)
return len(divisible)
#Uncomment the line below when your function is done
print(divisible_by_ten([20, 25, 30, 35, 40])) | jrbella/computer_science_icstars | basic_functions/divisible_by_ten.py | divisible_by_ten.py | py | 285 | python | en | code | 2 | github-code | 36 |
70911140265 | from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import sys
window = 0
width, height = 600, 400
mas1 = dict(X=[], Y=[])
a = 1
n = 2
def init():
glClearColor(1, 1, 1, 1.0) # Серый цвет дл... | youngtommypickles/ComputerGraphics | СG1.py | СG1.py | py | 2,445 | python | en | code | 0 | github-code | 36 |
23788787319 | from django.test import TestCase
from django.contrib.auth.models import User
from .models import Message, Thread
class ThreadTestCase(TestCase):
# prepara el entorno de pruebas
def setUp(self):
self.user1 = User.objects.create_user('user1', None, 'test1234')
self.user2 = User.objects.create_u... | mjmed/Django-Web-Playground | messenger/tests.py | tests.py | py | 3,080 | python | en | code | 0 | github-code | 36 |
70662155943 | class schedule:
def __init__(self, tags):
self.lst = [];
self.tags = tags;
self.value = 0;
def insert_block(self, block):
#When inserting a block you need to see if it has tags
#You need to update the schedules's value
#and you need to add it to the list of blocks
for item in block.tags... | kevinfreyberg/NASA-Space-Apps-2020 | schedule.py | schedule.py | py | 1,328 | python | en | code | 0 | github-code | 36 |
22534157712 | import cv2
import argparse
import numpy as np
from cam import *
camback_src = np.float32([[328, 363], [433, 359], [447, 482], [314, 488]])
camback_dst = np.float32([[814, 1359], [947, 1359], [947, 1488], [814, 1488]])
camleft_src = np.float32([[340, 426], [446, 424], [470, 554], [333, 554]])
camleft_dst = np.float32(... | Hyper-Bullet/littleAnt | perspect_stiching/perspective.py | perspective.py | py | 1,660 | python | en | code | 0 | github-code | 36 |
2722030803 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def mergeKLists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
head = ListNode(-1)
... | ZhengLiangliang1996/Leetcode_ML_Daily | List/23_MergeKlSortedLists.py | 23_MergeKlSortedLists.py | py | 1,403 | python | en | code | 1 | github-code | 36 |
74286578664 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import math
import numpy as np
import pytest
from .. import ChainedNeqSys, ConditionalNeqSys, NeqSys
try:
import pynleq2 # noqa
except ImportError:
HAVE_PYNLEQ2 = False
else:
HAVE_PYNLEQ2 = True
def f(x, params):... | bjodah/pyneqsys | pyneqsys/tests/test_core.py | test_core.py | py | 8,592 | python | en | code | 38 | github-code | 36 |
11859923041 | import numpy as np
import os
class mib_properties(object):
'''Class covering Merlin MIB file properties.'''
def __init__(self):
'''Initialisation of default MIB properties. Single detector, 1 frame, 12 bit'''
self.path = ''
self.buffer = True
self.merlin_size = (256,256)
... | matkraj/read_mib | mib.py | mib.py | py | 6,045 | python | en | code | 0 | github-code | 36 |
30977077952 | import numpy as np
from scipy.interpolate import lagrange
from numpy.polynomial.polynomial import Polynomial
import matplotlib as plt
size = int(input())
x = np.random.uniform(0, size, size)
y = np.random.uniform(0, size, size)
z = np.random.uniform(0, size, size - 1)
print("x:", x, "y:", y, "z:", z)
#x = np.array([0, ... | Mcken09/Numerical-methods1 | interpol_lagr.py | interpol_lagr.py | py | 646 | python | en | code | 0 | github-code | 36 |
74328989543 | #!/usr/bin/env python3
import csv
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
import requests
import sys
HEADERS = {'Authorization' : 'Bearer key1agtUnabRLb2LS', 'accept' : 'text/plain'}
BASE_URL = 'https://api.airtable.com/v0/appj3UWymNh6FgtGR/'
VIEW = 'view=Grid%20view'
# Values relat... | OpenEugene/little-help-book-web | table-of-contents-style-homepage/scripts/get_table.py | get_table.py | py | 8,591 | python | en | code | 6 | github-code | 36 |
12483653440 | students = {}
for _ in range(int(input())):
data = input().split()
name = data[0]
grade = float(data[1])
if name not in students:
students[name] = [grade]
else:
students[name] += [grade]
for student, grades in students.items():
print(f"{student} -> ", end="")
... | SimeonTsvetanov/Coding-Lessons | SoftUni Lessons/Python Development/Python Advanced January 2020/Python Advanced/05. TUPLES AND SETS/02. Average Student Grades.py | 02. Average Student Grades.py | py | 439 | python | en | code | 9 | github-code | 36 |
14303021398 | import cv2
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=str, default='data/haarcascade_frontalface_default.xml')
def main(args):
# Load the cascade
face_cascade = cv2.CascadeClassifier(args.model)
# To capture video from webcam.
cap = cv2.VideoCa... | sinantie/zumo-face-follower-rpi | test/test_detect_face_video.py | test_detect_face_video.py | py | 1,130 | python | en | code | 0 | github-code | 36 |
74157726824 | import psycopg2
import src.DBConfig as config
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
class Database:
def __init__(self, debugLogFile):
self.db_server_conn = None
self.database_params = None
self.db_cursor = None
self.db_name = None
self.bug_table_name =... | Danc2050/TheBugTracker | src/DatabaseScript.py | DatabaseScript.py | py | 6,480 | python | en | code | 1 | github-code | 36 |
569508846 | import sys,os
pathRacine=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..'))
if os.path.dirname(pathRacine) not in sys.path :
sys.path.insert(0,pathRacine)
from .dataBase import Base
if __name__ == "__main__":
from argparse import ArgumentParser
p=ArgumentParser()
p.ad... | luzpaz/occ-smesh | src/Tools/Verima/Base/exportToCSV.py | exportToCSV.py | py | 694 | python | en | code | 2 | github-code | 36 |
1914845096 | from joblib import parallel_backend
from tslearn.metrics import cdist_dtw, dtw
import pandas as pd
import numpy as np
def get_DTW_distance_matrix_w_mask(matrix1, matrix2, mask, window = 4, n_jobs = 1):
def calculate_distance(profiles):
profile1, profile2 = profiles
return dtw(matrix1.loc[profile1],... | jankrans/Conditional-Generative-Neural-Networks | repositories/profile-clustering/energyclustering/clustering/DTW.py | DTW.py | py | 1,570 | python | en | code | 0 | github-code | 36 |
17561063252 | # -*- coding: utf-8 -*-
import re
import os
import sys
import json
import time
import random
import urllib2
import win32gui
import win32con
import win32api
# Current path
ROOT = ""
# Log path
LOG_PATH = "log.txt"
# Replace special chars to this char in file name
NAME_FILL_CHAR = "-"
# Access random index separate
INDE... | AielloChan/pywallpaper | main.py | main.py | py | 9,893 | python | en | code | 6 | github-code | 36 |
26987702949 | import pytest
from privatechats.models import PrivateChatRoom, PrivateChatRoomMessage
@pytest.mark.django_db
def test_private_chat_room_str_method():
"""Test PrivateChatRoom __str__ method"""
group_chat_room_obj = PrivateChatRoom.objects.create(name='user1user2')
assert str(group_chat_room_obj) == 'use... | mf210/LetsChat | tests/privatechats/privatechats_model_tests.py | privatechats_model_tests.py | py | 808 | python | en | code | 1 | github-code | 36 |
34925500139 | import discord
from discord.ext import commands
from discord import Embed
from core.classes import *
class Global(CategoryExtension):
@commands.command()
@commands.has_permissions(manage_roles=True)
async def ping(self, ctx):
await ctx.send(f"Hey, it's me, HarTex! :eyes: Did you need something? ... | HTG-YT/hartex-discord.py | HarTex/cmds/global.py | global.py | py | 5,665 | python | en | code | 2 | github-code | 36 |
3207056630 | import datetime as dt
import platform
from pathlib import Path
from unittest import mock
import pdf2gtfs.user_input.cli as cli
from pdf2gtfs.config import Config
from pdf2gtfs.datastructures.gtfs_output.agency import (
GTFSAgency, GTFSAgencyEntry)
from test import P2GTestCase
def get_path_with_insufficient_perm... | heijul/pdf2gtfs | test/test_user_input/test_cli.py | test_cli.py | py | 11,810 | python | en | code | 1 | github-code | 36 |
32542356510 | from google.cloud import storage
from configparser import ConfigParser
from google.oauth2 import service_account
from googleapiclient.discovery import build
from utils.demo_io import (
get_initial_slide_df_with_predictions_only,
get_fovs_df,
get_top_level_dirs,
populate_slide_rows,
get_histogram_df,... | alice-gottlieb/nautilus-dashboard | examples/zarr_example.py | zarr_example.py | py | 1,548 | python | en | code | 0 | github-code | 36 |
8841422938 | from __future__ import print_function
import logging
import re
from db_endpoint import DBEndpoint,TCPFrameClient
from utils import blockify
from thread_executor import ThreadExecutor, ThreadExecutorError
from ida_ts import get_func_length, get_func_data, get_func_comment,\
set_func_comment, Functions, first_func_a... | xorpd/fcatalog_client | fcatalog_client/ida_client.py | ida_client.py | py | 10,885 | python | en | code | 26 | github-code | 36 |
10886549237 | """
Repetição
while(enquanto)
Execute um ação enquanto uma condição for verdadeira
loop infinito ->Quando um código não tem fim
"""
contador = 0
while contador <= 10:
print(contador)
contador = contador + 1
print('acabou') | GPainko/Curso_Udemy_Python | secao1/Aula29.py | Aula29.py | py | 241 | python | pt | code | 0 | github-code | 36 |
20475078540 | import pytz
import json
import os
import mimetypes
import requests
import tempfile
from django import forms
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from django.core.files.images import ImageFile, get_image_dimensions
f... | theju/smp | scheduler/forms.py | forms.py | py | 3,604 | python | en | code | 18 | github-code | 36 |
4495206080 | # This program gets a temperature in Celsius from the user and converts it to Fahrenheit
# 9/25
# CTI-110 P2HW1 - Celsius Fahrenheit Converter
# Darin McDonald
#
# Get temperature value input from user.
# Use formula to convert the value from Celsius to Fahrenheit.
# Display the converted temperature.
temp... | mcdonald5764/CTI110 | P2HW1_CelsiusConverter_DarinMcDonald.py | P2HW1_CelsiusConverter_DarinMcDonald.py | py | 459 | python | en | code | 0 | github-code | 36 |
16265691127 | class Solution:
def myAtoi(self, s: str) -> int:
MIN,MAX = -2**31, 2**31 - 1
sign, num = +1, 0
for i,x in enumerate(s.lstrip()):
if i==0 and x=="-": sign = -1
elif i==0 and x=="+": sign = +1
elif x.isdigit(): num = 10*num + int(x)
else: break... | alexbowe/LeetCode | 0008-string-to-integer-atoi/0008-string-to-integer-atoi.py | 0008-string-to-integer-atoi.py | py | 364 | python | en | code | 5 | github-code | 36 |
16230419939 | import PyPDF2
import warnings
# Open the PDF file in read-binary mode
pdf_file = open('1.2.826.1.3680043.9.5282.150415.2352.16502352212057.pdf', 'rb')
pdf_reader = PyPDF2.PdfReader(pdf_file)
num_pages = len(pdf_reader.pages)
text = ""
for page_number in range(num_pages):
page = pdf_reader.pages[page... | Muthukumar4796/Text-recognition-in-radiology-report-using-NLP- | nlp_project.py | nlp_project.py | py | 1,325 | python | en | code | 0 | github-code | 36 |
26151417012 | from pieces import *
class Player(object):
def __init__(self, color, position):
self.color = color
self.position = position
self.map = {}
self.enemy = None
self.moves = [None]
self.captured = []
self.dir = 0
self.createSet()
def __str__(self):
return self.color + " player: What's your next mov... | marcialpuchi/Chess | player.py | player.py | py | 2,285 | python | en | code | 0 | github-code | 36 |
5884209191 | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 1 17:39:54 2019
@author: Akshay
"""
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def alpha(line):
temp=[]
for word in line.split():
if is_number(word):
for num in l... | gakshaygupta/Semi-Supervised-Cross-Lingual-Text-summarization | undreamt/preprocessing 2.py | preprocessing 2.py | py | 5,534 | python | en | code | 0 | github-code | 36 |
17057454895 | import numpy as np
import random
import copy
from scipy.sparse import csr_matrix
import scipy.sparse as sp
class Stimuli:
'''
A distribution of stimuli classes defined by coreset
'''
def __init__(self, num_neurons=1000, nclasses=2, nsamples=50, m=None, r=0.9, q=0.01, k=100, sparse=False):
'''... | minzsiure/Variable-Binding-Capacity | stimuli.py | stimuli.py | py | 6,358 | python | en | code | 0 | github-code | 36 |
40556512110 | import os
import time
import requests
import telegram
import logging
from dotenv import load_dotenv, find_dotenv
logger = logging.getLogger('__name__')
class TelegramBotHandler(logging.Handler):
def __init__(self, log_bot, chat_id):
super().__init__()
self.chat_id = chat_id
self.log_bo... | Kilsik/Check_Devman_lessons | main.py | main.py | py | 2,618 | python | en | code | 0 | github-code | 36 |
24493301010 | class Solution:
def maxSumAfterPartitioning(self, arr: List[int], k: int) -> int:
def helper(i,arr,n,k,dp):
if(i==n):
return 0
if(dp[i]!=-1) :
return dp[i]
maxi=-10**9
maxians=-10**9
leng=0
... | tanuchaurasiya/Leetcode | 1043-partition-array-for-maximum-sum/1043-partition-array-for-maximum-sum.py | 1043-partition-array-for-maximum-sum.py | py | 647 | python | en | code | 0 | github-code | 36 |
71858991465 |
Filepath = r"C:\Users\Padraig\Desktop\Development\AdventOfCode\2022\P2\p2.txt"
def PreprocessData(filepath):
input = open(filepath).readlines()
roundArray = []
for i in range(len(input)):
round = input[i].strip().split()
roundArray.append([round[0], round[1]])
return roundAr... | Pad094/AoC-2022 | p2.py | p2.py | py | 2,053 | python | en | code | 0 | github-code | 36 |
18914571723 | import pytest
from src.can_place_flowers import Solution
@pytest.mark.parametrize(
"flowerbed,n,expected",
(
([1, 0, 0, 0, 1], 1, True),
([1, 0, 0, 0, 1], 2, False),
([1, 0, 0, 0, 0, 1], 2, False),
([0], 1, True),
),
)
def test_solution(flowerbed, n, expected):
assert ... | lancelote/leetcode | tests/test_can_place_flowers.py | test_can_place_flowers.py | py | 373 | python | en | code | 3 | github-code | 36 |
26819728584 |
# import math
import requests
import re
def get_url():
return ''.join([
'http'+ ':' + '//',
'.'.join(['www', 'cyber'+'syndrome', 'net']),
'/'+'search.cgi'+'?' + '&'.join(['q=JP', 'a=A', 'f=d', 's=new', 'n=100'])
])
def read_page():
url = get_url()
ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)... | otsutomesan/proxy80 | proxy80/proxy80.py | proxy80.py | py | 2,426 | python | en | code | 0 | github-code | 36 |
37166463882 | import math
import matplotlib.pyplot as plt
def integral(n):
val = [1 - math.exp(-1)]
if n < 1:
return val
for i in range(1,n+1):
val.append(1 - i*val[i-1])
return val
n = 20
x = range(0,n+1)
y = integral(n)
plt.plot(x, y, 'r')
plt.xlabel('k')
plt.ylabel('I(k)')
plt.show() | Aditi-Singla/Numerical-Algorithms | Homework 1/q7_integral.py | q7_integral.py | py | 300 | python | en | code | 0 | github-code | 36 |
36311420419 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 6 16:56:25 2020
@author: doria
"""
#***Interface graphique***
from tkinter import *
#creation des des fichiers textes
#Path
path_file = open("path_file_IMU.txt","r")#"C:/Users/doria/Desktop/project_5siec/Sensors_file/data/IMU/"
path = path_file.readline()
... | siec2020/simulator | Sensors_file/code_python/interface_valeurs_IMU.py | interface_valeurs_IMU.py | py | 2,494 | python | en | code | 1 | github-code | 36 |
71399052905 | import random
logo = """
.------. _ _ _ _ _
|A_ _ |. | | | | | | (_) | |
|( \/ ).-----. | |__ | | __ _ ___| | ___ __ _ ___| | __
| \ /|K /\ | | '_ \| |/ _` |/ __| |/ / |/ _` |/ __| |/ /
| \/ | / \ | | |_) | | (_| |... | SoulReaper06/BlackJack | blackjack.py | blackjack.py | py | 2,574 | python | en | code | 0 | github-code | 36 |
32995011041 | """
Test executors logic.
"""
import yaml
from unittest import TestCase
from voluptuous import Schema
from six import StringIO
from mock import (
patch,
call,
MagicMock,
)
from plix.executors import (
BaseExecutor,
ShellExecutor,
)
from .common import MockDisplay
class ExecutorsTests(TestCase... | freelan-developers/plix | tests/test_executors.py | test_executors.py | py | 3,697 | python | en | code | 1 | github-code | 36 |
6501362442 | # Erstelle eine neue datenbank
# exit(1): Verbindungsfehler
# exit(1): Ausführungsfehler
# DB-Modul einbinden
import mysql.connector
# Verbindung zum DB-Server herstellen
try:
conn = mysql.connector.connect(user="root",
host="localhost")
except mysql.connector.Error as ... | BadRix90/ITT-NET | Jan10_Datenbank_erstellen.py | Jan10_Datenbank_erstellen.py | py | 758 | python | de | code | 0 | github-code | 36 |
24579676914 | from math import sin,pi
from tkinter import Tk,Canvas
## from pylab import linspace,sin
import sys
if sys.version_info.major == 2 and sys.version_info.minor == 7 :
print(sys.version)
import Tkinter as tk
import tkFileDialog as filedialog
elif sys.version_info.major == 3 and sys.version_info.minor == 6 :
... | AminaSaoudi/Piano | frequencies_V.py | frequencies_V.py | py | 3,081 | python | en | code | 0 | github-code | 36 |
34101450986 | #!/usr/bin/python3
import pandas as pd
import numpy as np
import seaborn as sns
import statsmodels.formula.api as sm
import pylab as plt
import argparse
import os
import matplotlib
from matplotlib.gridspec import GridSpec
from pathlib import Path
from tqdm import tqdm
plt.style.use('bmh')
HOME = str(Path.home())
PLO... | Airplaneless/presentationEAVM | createPlot.py | createPlot.py | py | 3,017 | python | en | code | 0 | github-code | 36 |
10256190705 | import threading
import time
import pygame
import random
import socket
import pickle
"""
10 x 20 square grid
shapes: S, Z, I, O, J, L, T
represented in order by 0 - 6
"""
pygame.font.init()
# GLOBALS VARS
s_width = 1200
s_height = 750
play_width = 300 # meaning 300 // 10 = 30 width per block
play_height = 600 # m... | lewis0926/online-tetris-game | client.py | client.py | py | 13,057 | python | en | code | 0 | github-code | 36 |
39560569268 | import math
ceil = 1<<31
floor=(1<<31)
class Node:
def __init__(self, data):
self.data = data
self.child = []
# Utility function to create a new tree node
def newNode(data):
temp = Node(data)
return temp
def constructor(lst,n):
root = None
stack = []
for i in... | prabhat24/trees | generic_trees/q26_kth_largest_element.py | q26_kth_largest_element.py | py | 1,342 | python | en | code | 0 | github-code | 36 |
36733139947 | import sys
import threading
import numpy as np
def process_tree(start_index, nodes):
zzz = 0
aaa = []
l = 0
# np_array = np.array(nodes)
# aaa = np.where(np_array == start_index)[0]
aaa = [i for i, e in enumerate(nodes) if e == start_index]
if len(aaa) == 0:
return 1
for k... | DA-testa/tree-height-from-empty-ValerijaLinkevica | tree_height.py | tree_height.py | py | 1,297 | python | en | code | 0 | github-code | 36 |
17790722002 | #!/usr/bin/env python
import time
import sys
i = 0
while i < 30000:
i += 1
sys.stdout.write('upstream-output: ' + str(i) + '\n')
sys.stdout.flush()
if i % 5000 == 0:
time.sleep(1)
| typd/non-blocking-pipe | test/fast-upstream.py | fast-upstream.py | py | 206 | python | en | code | 1 | github-code | 36 |
72871607463 | import numpy as np
import os
import torch
from tqdm import tqdm
from PIL import Image
import wandb
from .evaluation import eval_llh, eval_translation_error, rotation_model_evaluation, translation_model_evaluation
# Global variables
DEVICE = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
def cos... | LDenninger/se3_pseudo_ipdf | se3_ipdf/training.py | training.py | py | 7,997 | python | en | code | 0 | github-code | 36 |
34455433400 | # -*- coding: utf8 -*-
from django.contrib import admin
from models_app.models import Document
@admin.register(Document)
class DocumentAdmin(admin.ModelAdmin):
list_display = [
'id',
'name',
'file',
'position',
'task',
]
list_display_links = (
'id',
... | Aplles/project_tracker | models_app/admin/document/resources.py | resources.py | py | 472 | python | en | code | 0 | github-code | 36 |
12108906851 | import sys
from socket import *
def main():
# checking usage
if len(sys.argv) != 2:
print("Usage: python WebServer.py port")
exit(1)
# getting the port
serverPort = int(sys.argv[1])
# creating the socket and binding to port
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('',serverPort))
ser... | maddydobbie/cs3331 | Lab3/WebServer.py | WebServer.py | py | 1,002 | python | en | code | 0 | github-code | 36 |
15467387894 | from openpyxl.styles import Font, Border, Side, PatternFill, Alignment
from openpyxl import load_workbook
wb = load_workbook("/Users/gunju/Desktop/self study/python/deep/rpa_basic/1_excel/sample.xlsx")
ws = wb.active
a1 = ws["A1"]
b1 = ws["B1"]
c1 = ws["C1"]
ws.column_dimensions["A"].width = 5 # A열 너비 5로 설정
ws.row_di... | hss69017/self-study | deep/rpa_basic/1_excel/11_cell_style.py | 11_cell_style.py | py | 1,608 | python | en | code | 0 | github-code | 36 |
32948325933 | import sys
#sys.path.insert(0, "/home/tomohiro/workspace/web_scraping_venv/lib/python3.6/site-packages")
from flask import Flask, render_template, request
from flask_socketio import SocketIO, emit, send
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from bs4 import BeautifulSoup
import requests
im... | tomohiro3/scraping | work/flask_script.py | flask_script.py | py | 7,063 | python | en | code | 1 | github-code | 36 |
74362480745 | import scipy as sp
import numpy as np
import math
import input_checks
import ode_solver
def sparse_A(size, dm, do):
"""
Creates a sparse matrix used by the scipy spsolve function.
----------
Parameters
size : int
The square dimension value of the matrix.
dm : float OR int
Valu... | jack-parr/scientific_computing | pde_solver.py | pde_solver.py | py | 9,406 | python | en | code | 0 | github-code | 36 |
3685897986 | #!/usr/bin/python2
from time import gmtime, strftime
serverLogFilename = "server_debug.log"
def writeToLog(fileName, data):
"""
function to maintain log for debugging
:param fileName: name of the log file
:param data: data to be written in string format
:return: None
"""
with open(fileNam... | BharathTalloju/Node_fileServer | Server/serverLog.py | serverLog.py | py | 706 | python | en | code | 0 | github-code | 36 |
72974850025 | # Diseña un programa con una función que pida un número entero entre 1 y 7 y devuelva el día de la semana con letra.
def dia(n):
d=""
if n==1:
d="L"
elif n==2:
d="M"
elif n==3:
d="M"
elif n==4:
d="J"
elif n==5:
d="V"
elif n==6:
d="S"
elif ... | litailopez/Programas_python_MITA | p108-dia-semana.py | p108-dia-semana.py | py | 483 | python | es | code | 0 | github-code | 36 |
7055591052 | """
5.创建技能类(技能名称,攻击比率,消耗法力,持续时间)
保证数据范 0 - 2 0 - 80 0 - 120
"""
class Profession:
def __init__(self, name, attack, cost, duration):
self.name = name
self.attack = attack
self.cost = cost
self.duration = duration
@property
def attack(self):
return self._... | haiou90/aid_python_core | day10/homework_personal/02_homework.py | 02_homework.py | py | 1,076 | python | en | code | 0 | github-code | 36 |
25569986801 | from json import load
from tkinter.font import BOLD
from openpyxl import load_workbook
from openpyxl.styles import PatternFill, Font
def edm(filename):
wb = load_workbook(filename)
sheet = wb['Recipients']
sheet2 = wb['Link Clicks - Detail']
# Deleting empty rows
sheet.delete_rows(1,1)
... | iWantCry/eDM-Stats | edm.py | edm.py | py | 2,256 | python | en | code | 0 | github-code | 36 |
17444702079 | from mimetypes import init
from turtle import forward
from torch import conv2d
import torch
import torch.nn as nn
import common
#from model import common
import torch.nn.functional as F
import math
import cv2
import os
import datetime
import scipy.io as io
import numpy as np
def EzConv(in_channel,o... | HuQ1an/GELIN_TGRS | Ours.py | Ours.py | py | 8,839 | python | en | code | 1 | github-code | 36 |
263755309 | """
https://leetcode.com/problems/sum-of-all-odd-length-subarrays/
Given an array of positive integers arr, calculate the sum of all possible odd-length subarrays.
A subarray is a contiguous subsequence of the array.
Return the sum of all odd-length subarrays of arr.
"""
"""
For array of size x, start with x subarrays... | brandonaltermatt/leetcode-solutions | easy/array/sum_of_all_odd_length_subarrays.py | sum_of_all_odd_length_subarrays.py | py | 850 | python | en | code | 0 | github-code | 36 |
43045351216 | import time
import json
import os
import requests
class pokemon:
def __init__(self, number, energy):
self.number = number
self.energy = 50
self.hp = hp_from_id(number)
self.attack = attack_from_id(number)
self.defense = defense_from_id(number)
self.special_attack = s... | Hayden987/PokEggHunt | main.py | main.py | py | 2,832 | python | en | code | 0 | github-code | 36 |
7005637816 | """Deleted_columns_in_city
Revision ID: 7b8f459a61b0
Revises: e280451841bb
Create Date: 2021-11-11 15:08:06.260280
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '7b8f459a61b0'
down_revision = 'e280451841bb'
branch_labels =... | nazarkohut/room_book | migrations/versions/7b8f459a61b0_deleted_columns_in_city.py | 7b8f459a61b0_deleted_columns_in_city.py | py | 1,089 | python | en | code | 0 | github-code | 36 |
298698477 | # Write a web scraper that fetches the information from the Wikipedia page
# on Web scraping. Extract all the links on the page and filter them so the
# navigation links are excluded.
# Programmatically follow one of the links that lead to another Wikipedia article,
# extract the text content from that article, and sav... | symonkipkemei/cnd-labs | python-301/resources/04_web-scraping/04_05_wiki_scrape.py | 04_05_wiki_scrape.py | py | 1,751 | python | en | code | 0 | github-code | 36 |
2663633428 | from HaierTV import HaierTV
from HisenseTV import HisenseTV
class TVFactory(object):
@staticmethod
def produceTV(brand):
if brand.lower() == 'haier':
print("正在生产一个Haier电视...")
return HaierTV()
elif brand.lower() == 'hisense':
print("正在生产一个Hisense电视...")
... | Tiierr/Design-Patterns | Python/simple-factory/simple01/TVFactory.py | TVFactory.py | py | 445 | python | en | code | 0 | github-code | 36 |
71570408423 | import time
import numpy as np
import math
from numba import cuda
from matrix_operations import matmul_packed32_shared, matmul_packed32, TPB
from matrix_convert import to_gpu, from_gpu, to_type, from_type
np.random.seed(1)
def run_uint32(size=10000, times=50, sparsity=0.7):
A, B = np.random.randint(0, 100, (size... | EgorNemchinov/formal-languages | test_multiplication.py | test_multiplication.py | py | 1,614 | python | en | code | 0 | github-code | 36 |
33441962447 | def diff(L1,L2):
S=[]
L = []
l = []
for i in L1:
if i not in L:
L.append(i)
for j in L2:
if j not in l:
l.append(j)
for i in L:
if i not in l:
S.append(i)
print(S)
L1 = ['Prabhjeet','Singh']
L2 = ['Singh']
diff(L1... | Hiteshwalia4/Python-Programs | sept22 prac/22 sept pb (1).py | 22 sept pb (1).py | py | 325 | python | en | code | 0 | github-code | 36 |
29292987146 | import typer
from typing import Optional
import os
import sys
import json
from alternat.generation import Generator
from alternat.generation.exceptions import InvalidConfigFile, InvalidGeneratorDriver
from alternat.collection import Collector
import subprocess
import shutil
app = typer.Typer()
# This key determines ... | keplerlab/alternat | app.py | app.py | py | 5,217 | python | en | code | 18 | github-code | 36 |
3131400290 | import random
# класс мечник для получения аттрибутов
class Swordman:
name: str
strength: int
agility: int
def __init__(self):
self.name = "swordman"
self.strength = 10000
self.agility = 5
# класс лучник для получения аттрибутов
class Archer:
name: str
strength: int
... | lifehacker1336/mygame | main.py | main.py | py | 6,158 | python | ru | code | 0 | github-code | 36 |
37486587273 | import unittest
import timeit
# Solution that uses O(n) space to store the result.
def not_in_place(xs):
xs.sort()
result = [xs[0]]
for ca, cb in xs[1:]:
pa, pb = result[-1]
if ca <= pb:
result[-1] = (pa, max(pb, cb))
else:
result.append((ca, cb))
return... | tvl-fyi/depot | users/wpcarro/scratch/deepmind/part_two/merging-ranges.py | merging-ranges.py | py | 3,055 | python | en | code | 0 | github-code | 36 |
13158886481 | from flask import Flask, render_template, jsonify
import serial
import sys
import threading
import openpyxl
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
import datetime
app = Flask(__name__)
latest_tag = ''
tag_count = 0
tag_data = []
def convert_tag_from_bytes_to_hex(tag... | SudeepKulkarni3301/LI2-Internship | app_excel_file.py | app_excel_file.py | py | 3,692 | python | en | code | 0 | github-code | 36 |
6395153010 | from typing import List
def add_value_to_rating(new_value: int, rating: List[int]):
insert_at = len(rating)
for i in range(len(rating)):
if rating[i] < new_value:
insert_at = i
break
rating.insert(insert_at, new_value)
rating = [7, 5, 3, 3, 2]
print('Текущий рейтинг:', ra... | vlp4/study-python | lesson2/task5.py | task5.py | py | 601 | python | en | code | 0 | github-code | 36 |
12483623850 | # This is my solution
"""
def solve():
n, s, x = (int(element) for element in input().split())
stack = [int(num) for num in input().split()]
[stack.pop() for i in range(s)]
if x in stack:
print("True")
elif len(stack) >= 1:
print(min(stack))
else:
print(0)
... | SimeonTsvetanov/Coding-Lessons | SoftUni Lessons/Python Development/Python Advanced January 2020/Python Advanced/04. EXERCISE LISTS AS STACKS AND QUEUES/01.Basic Stack Operations.py | 01.Basic Stack Operations.py | py | 743 | python | en | code | 9 | github-code | 36 |
70354282345 | from odoo import api, models
class CheckReportWizard(models.TransientModel):
_name = 'check.report.wizard'
@api.multi
def print_report(self):
active_ids = self.env.context.get('active_ids', [])
payments = self.env['account.payment'].browse(active_ids)
datas = {
'ids':... | eman000tahaz/arc-s | mass_payment/wizard/check_report_wizard.py | check_report_wizard.py | py | 523 | python | en | code | 1 | github-code | 36 |
6466876479 | #!/usr/bin/env python
import subprocess, threading, sys, os, inspect
from threading import Thread
baseDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
class startProcess (threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
subprocess.Popen([baseDir... | ebbesmoeller/Fonograf | servers/start.py | start.py | py | 568 | python | en | code | 0 | github-code | 36 |
17704058430 | import os
import yaml
from behave import fixture, use_fixture
from selenium import webdriver
browser_type = os.environ.get("BROWSER", "chrome")
platform = os.environ.get("PLATFORM", "desktop")
def get_browser(name):
if name == "chrome":
return webdriver.Chrome()
else:
return None
def get_v... | ChaitanyaAdhav/SHORE_Capital | features/environment.py | environment.py | py | 1,566 | python | en | code | 0 | github-code | 36 |
22912869355 | import argparse
import conf
from dfwrapper import HeinzWrapper, ResistanceWrapper
from plotting import Plotter
def main(args):
conf.configure_from_args(args)
curr_wrapper = HeinzWrapper(conf.curr_file_names, 'curr')
volt_wrapper = HeinzWrapper(conf.volt_file_names, 'volt')
comb_wrapper = ResistanceWra... | ligerlac/HVAnalysis | HVAnalysis/make_resistance_plot.py | make_resistance_plot.py | py | 839 | python | en | code | 0 | github-code | 36 |
18973862172 | #!d:/python/python.exe
# *********************************************************************
# Program to submit the interim and full export publishing job.
# ---------------------------------------------------------------------
# Created: 2007-04-03 Volker Englisch
# *********************************... | NCIOCPL/cdr-publishing | Publishing/SubmitPubJob.py | SubmitPubJob.py | py | 18,579 | python | en | code | 0 | github-code | 36 |
17895317270 | from typing import Any, Mapping, Optional, Union, Tuple
from flax.core import scope as flax_scope
import jax
import jax.numpy as jnp
import t5x.models as t5x_models
from models import gp_models # local file import from baselines.t5
from models import models as ub_models # local file import from baselines.t5
Array = ... | google/uncertainty-baselines | baselines/t5/models/be_models.py | be_models.py | py | 7,534 | python | en | code | 1,305 | github-code | 36 |
39835449540 | import tkinter as tk
import random
plocha=tk.Canvas(width=1000,height=500)
n=int(input("Zadaj počet napísov (min. 15):"+"\n"))
plocha.pack()
if n<15:
print("Chyba!!! Zadané číslo musí byť min.15!")
else:
for i in range(n):
x=random.randint(50,950)
y=random.randint(50,450)
veľkosť=random.... | Rastislav19/programs-learning | Python-EKG/písomka2/8.py | 8.py | py | 512 | python | sk | code | 0 | github-code | 36 |
27916680997 | """
File: class_reviews.py
Name:黃稚程 mike
-------------------------------
At the beginning of this program, the user is asked to input
the class name (either SC001 or SC101).
Attention: your program should be case-insensitive.
If the user input -1 for class name, your program would output
the maximum, minimum, and avera... | HuangChihCheng/stanCodeProjects | class_reviews.py | class_reviews.py | py | 2,201 | python | en | code | 0 | github-code | 36 |
8984732684 | # pylint: disable=too-many-public-methods, too-many-arguments, fixme
"""
CVE-bin-tool tests
"""
import importlib
import os
import shutil
import sys
import tempfile
import unittest
import pytest
from cve_bin_tool.cvedb import CVEDB
from cve_bin_tool.version_scanner import VersionScanner
from .test_data import __all__ ... | chinvib66/cve-bin-tool | test/test_scanner.py | test_scanner.py | py | 7,556 | python | en | code | null | github-code | 36 |
39885505055 | import pandas as pd
import re
from csv import reader
import altair as alt
import streamlit as st
from pandas.api.types import is_numeric_dtype
from urllib import request
# Page settings
st.set_page_config(
layout='wide',
initial_sidebar_state="expanded"
)
m = st.markdown("""
<style>
div.st... | ceghisolfi/tec-campaign-finance | analysis/campaign-finance-app.py | campaign-finance-app.py | py | 18,633 | python | en | code | 0 | github-code | 36 |
8158101065 | """Parse the YAML configuration."""
import logging
from pathlib import Path
from typing import Optional, Dict, Callable, Tuple, Union
import yaml
import torch
from . import utils
logger = logging.getLogger("casanovo")
class Config:
"""The Casanovo configuration options.
If a parameter is missing from a us... | Noble-Lab/casanovo | casanovo/config.py | config.py | py | 4,091 | python | en | code | 75 | github-code | 36 |
34412858770 | # -- coding: utf-8 --`
import os
import argparse
import json
import botocore
import boto3
def main(args):
cfg = botocore.config.Config(retries={'max_attempts': 0}, read_timeout=900, connect_timeout=900)
args = {k: v for k, v in args.items() if v is not None}
try:
lambda_client = boto3.client('lam... | densenkouji/stable_diffusion.openvino.lambda | demo.py | demo.py | py | 3,184 | python | en | code | 3 | github-code | 36 |
28674852117 | import time
t = time.time()
s = time.ctime(t)
print(s)
r = time.localtime(t)
print(r.tm_mday)
t = time.strftime('%Y-%m-%d %H-%M-%S')
print(t)
| 1024Person/LearnPy | Day19/time01.py | time01.py | py | 148 | python | en | code | 0 | github-code | 36 |
28438842371 | from aiohttp import web
import sys
import os
import argparse
import simplejson as json
import functools
import sqlite3
import threading
import requests
import datetime
import dateutil.parser
import simplejson as json
from collections import defaultdict
from routes import routes
from calculation.task import Task
from... | kuris996/ws | main.py | main.py | py | 3,882 | python | en | code | 0 | github-code | 36 |
21213270872 | import pandas as pd
from tqdm import tqdm
from Database_comparator.config_class import cfg
import os
from Bio.Blast.Applications import NcbiblastpCommandline
from Bio.Blast.Applications import NcbimakeblastdbCommandline
import Database_comparator.Fasta_maker as Fasta_maker
import Database_comparator.db_aligner as db_a... | preislet/Database_comparator | Database_comparator/db_blast.py | db_blast.py | py | 8,294 | python | en | code | 0 | github-code | 36 |
38192341046 | import decimal
from django.conf import settings
from django.contrib import messages
from django.db.models import Sum
from django.shortcuts import render, redirect, get_object_or_404
from ..models import *
from ..forms import *
from ..models import *
from django.contrib.auth.decorators import login_require... | luggiestar/kahama | KCHS/views/student_views.py | student_views.py | py | 8,479 | python | en | code | 0 | github-code | 36 |
73066378345 | from unittest import TestCase
from agents.memory import Memory
class TestMemory(TestCase):
def test_sample(self):
mem = Memory(10) # 10 should be more than enough for this test
experiences = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
mem.add(experiences[0])
mem.add(experiences[1])
... | TheMikeste1/CS6640-Waterworld | agents/test_memory.py | test_memory.py | py | 1,070 | python | en | code | 0 | github-code | 36 |
73742845865 | import logging
import json
import os
from common import utils
from table_order.table_order_item_list import TableOrderItemList
# 環境変数の取得
LOGGER_LEVEL = os.environ.get("LOGGER_LEVEL")
# ログ出力の設定
logger = logging.getLogger()
if LOGGER_LEVEL == 'DEBUG':
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.I... | line/line-api-use-case-table-order | backend/APP/category_get/category_get.py | category_get.py | py | 1,543 | python | ja | code | 13 | github-code | 36 |
27541033350 | import re
from Bio import AlignIO, SeqIO
from Bio.Seq import Seq
import argparse
# This section defines the input options. You can copy and modify this section for future scripts, it's very handy! In that case don't forget to import the argparse package (import argparse)
# Get arguments
def add_arguments(parser):
... | tandermann/python_for_biologists | data/alignment_formatter.py | alignment_formatter.py | py | 2,210 | python | en | code | 4 | github-code | 36 |
43009956361 |
"""
Purpose: Project Euler problems
Date created: 2019-10-22
Contributor(s): Mark M.
ID: 466
Title: Distinct terms in a multiplication table
URI: https://projecteuler.net/problem=466
Status: Testing
Desc:
Let P(m,n) be the number of distinct terms in an m×n multiplication table.
For example, a 3×4 multipli... | MarkMoretto/project-euler | incomplete/problem-466-tf.py | problem-466-tf.py | py | 2,743 | python | en | code | 1 | github-code | 36 |
24859269966 | import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
HOUSING_PATH = os.path.join("datasets", "housing")
def load_housing_data(housing_path=HOUSING_PATH):
csv_path = os.path.join(housing_path, "housing.csv")
return pd.read_csv(csv_path)
def split_train_test(data, tes... | vncntprz/Python-Projects | 499_machine_Intelligence/Scikit/Demo/chapter 2 load data.py | chapter 2 load data.py | py | 1,472 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.