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
70007493096
from tkinter import messagebox; def labelSlider(): global count,sliderwords text="Welcome to typing speed increaser game" if(count>=len(text)): count=0 sliderwords='' sliderwords+=text[count] count+=1 fontlabel.configure(text=sliderwords) fontlabel.after(300,labelSlider) def...
surjeetlodhirajput/TypingSpeedCheckUsingPython
typingspeed.py
typingspeed.py
py
3,159
python
en
code
0
github-code
90
5563490030
from SoftwareDesignPatterns.Bridge.post_refactor.order_type import TakeOut from beverage_additions import WaterAddition, ExtraAddition, MilkAddition from beverages import Beverage, Coffee, Chocolate, Tea def beverage_info(beverage: Beverage): print("=========================") beverage.prepare() print(f"C...
kristyko/SoftwareDesignPatterns
Bridge/post_refactor/main.py
main.py
py
953
python
en
code
0
github-code
90
18950541337
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('artist', '0001_initial'), ] oper...
hqpr/fame
apps/artist/migrations/0002_music.py
0002_music.py
py
1,547
python
en
code
0
github-code
90
17950229949
import sys from collections import Counter input = sys.stdin.readline h,w,*a = map(int,input().split()) a = [] for i in range(h): a += list(input().strip()) m1 = (h%2)*(w%2) m2 = (h%2)*(w//2)+(h//2)*(w%2) c = Counter(a) c1,c2, = 0,0 for i in c.values(): dc2,dc1 = divmod(i%4,2) c1 += dc1 c2 += dc2 print("Yes" if...
Aasthaengg/IBMdataset
Python_codes/p03593/s887087441.py
s887087441.py
py
349
python
en
code
0
github-code
90
36669256534
#!/usr/bin/env python import os import sys from pathlib import Path import setuptools if sys.argv[-1] == "publish": os.system("python setup.py sdist upload") sys.exit() # read the contents of your README file from os import path this_directory = path.abspath(path.dirname(__file__)) long_description = Path(...
rsnodgrass/pyadtpulse
setup.py
setup.py
py
1,110
python
en
code
15
github-code
90
19245569700
# coding: utf-8 # Idosos Fila | Programação 1 - UFCG # Alessandro Lia Fook Santos, 2015, (C) def idosos_inicio(fila): contador = 0 for indice in range(len(fila)): if fila[indice] >= 60: fila[contador], fila[indice] = fila[indice], fila[contador] contador += 1 fila = [25, 33, 67, 61, 35, 8, 12, 15, 22, 63, 7...
alessandroliafook/P1
unidade6/idosos_fila/idosos_fila.py
idosos_fila.py
py
355
python
pt
code
0
github-code
90
72270000616
""" **This module implements metric collecting function** """ import daemon import daemon.pidfile import datetime import logging import json import linecache import os import mmap import psutil import signal import time from prometheus_client import CollectorRegistry, Counter, Gauge, Histogram, Summary, write_to_textf...
yabamuro/mediation-fluentd-prometheus
metricCount.py
metricCount.py
py
10,361
python
en
code
0
github-code
90
5911672870
from django.contrib.auth.models import User from django.db import transaction from django.db.models.query import QuerySet from isic.core.models.collection import Collection from isic.core.services.collection import collection_lock from isic.studies.models import Study, StudyTask def study_create( *, creator:...
ImageMarkup/isic
isic/studies/services/__init__.py
__init__.py
py
1,406
python
en
code
3
github-code
90
18011709899
import math def comb(n, k): return math.factorial(n) // (math.factorial(n - k) * math.factorial(k)) n, a, b = map(int,input().split()) v = list(map(int, input().split())) v.sort(reverse=True) max_avg = sum(v[:a]) / a min_v = min(v[:a]) ans = 0 for i in range(a, b+1): if max_avg != sum(v[:i]) / i: break c...
Aasthaengg/IBMdataset
Python_codes/p03776/s051003543.py
s051003543.py
py
430
python
en
code
0
github-code
90
42600733503
def creating_set(): first_set = {1,2,3,4,5,1,2,3,4,5} print(first_set) another_set = set([1,2,3,4,5,5,5,5,6]) print(another_set) another_set.add("a") another_set.add("b") print(another_set) def set_union(): print("Set Unions") numbers_one = {1, 2, 3, 4, 5} numbers_two = {4, 5, ...
andresmontoyab/Python
basic-python/Set.py
Set.py
py
676
python
en
code
0
github-code
90
8183256744
#!/usr/bin/python # encoding: utf-8 import sys import os import re def update(todo): filename = '/Users/king/todolist.md' with open(filename) as fin: lines = fin.readlines() lines = [line.strip() for line in lines] if todo[:9] == 'complete:': todo = todo[10:] elif todo[:7] == 'dele...
lipingcoding/todolist_alfred_workflow
update.py
update.py
py
496
python
en
code
0
github-code
90
3331492196
"""图 基于邻接矩阵存储""" class Graph(object): def __init__(self, Matrix): vnum = len(Matrix) for x in Matrix: if len(x) != vnum: raise ValueError('False') self.Mat = [Matrix[i][:] for i in range(vnum)] self.Vnum = vnum self.edgenum = 0 for i in r...
pankypan/DataStructureAndAlgo
code/graph/matrix_graph.py
matrix_graph.py
py
1,357
python
en
code
4
github-code
90
29432091294
#5 variant import random #Ülusanne 1 n=int(input("Sisestage majade arv 1 kuni 9: ")) maja=""" ~~~~~ /_____\\ | [] | ----- """ if n>0 and n<10: for i in range(n): if n>0 and n<9: print(maja, end=" ") else: print("Sisestage arv vahemikus 1 kuni 9") #Üles...
AntonBuivol/Ts-kkel-kotrolt-
Tsükkel kotroltöö/Tsükkel_kotroltöö.py
Tsükkel_kotroltöö.py
py
1,086
python
et
code
0
github-code
90
33817224379
import pygame,math,time import intro import tablero from enemigo import Roca,RocaLoca,Marciano,MarcianoPlus from niveles import Niveles from player import Player,Disparo # puntaje puntaje = 0 # nivel nivel_actual = 1 def main(nivel_param): # inicializamos el juego pygame.init() # obtiene el número de mil...
patricioarango/llegar_al_sol
main.py
main.py
py
11,135
python
es
code
0
github-code
90
19364177184
import logging from vine import ensure_promise, promise from .exceptions import AMQPNotImplementedError, RecoverableConnectionError from .serialization import dumps, loads __all__ = ('AbstractChannel',) AMQP_LOGGER = logging.getLogger('amqp') IGNORED_METHOD_DURING_CHANNEL_CLOSE = """\ Received method %s during clo...
celery/py-amqp
amqp/abstract_channel.py
abstract_channel.py
py
4,829
python
en
code
298
github-code
90
20749723551
# nl=[number*0.01 for number in range(1,6)] # print(nl) # count= 0 # rate = int(input('rate:')) # while count < rate: # print(count) # count+=1 from openpyxl import Workbook import numpy as np from openpyxl.chart import ( AreaChart, Reference, Series, ) lv=float(input('貸款金額:')) repay='本息攤還' #input('...
Hsien-Chen/for_python
pythontrain/理財方法.py/本息平均攤還.py
本息平均攤還.py
py
4,190
python
en
code
0
github-code
90
1375235349
import glob import re import ujson import collections # with open("file_ids.txt", "wb") as file: # for folderID in glob.glob("annotations/*/"): # folderID = folderID.split('/')[1] # folderID = folderID.lstrip('0') # file.write(folderID + "\n") #cleaned_data = collections.OrderedDict() # ...
Jacobvs/ML-Music-Analyzer
id_file.py
id_file.py
py
1,625
python
en
code
13
github-code
90
11043571403
import logging from collections import OrderedDict, defaultdict from datetime import datetime from typing import Optional import numpy as np import pandas as pd import torch from torch.utils.data.dataset import Dataset from neuralprophet import configure, utils from neuralprophet.df_utils import get_max_num_lags from...
ourownstory/neural_prophet
neuralprophet/time_dataset.py
time_dataset.py
py
30,011
python
en
code
3,415
github-code
90
42863011123
import discord from discord.ext import commands from discord.utils import get from Utils.Logger import Logger from Database.DBUtils import isUserSupport from Utils.Cache import support_nums_id_cache, support_tickets_cache class Support(commands.Cog): def __init__(self, bot): self.bot = bot ...
Vexxlol/AvexRewrite
src/Cogs/Support.py
Support.py
py
1,611
python
en
code
0
github-code
90
7942620177
""" List From a Range of Numbers Create a function that returns a list of all the integers between two given numbers start and end. Examples range_of_num(2, 4) ➞ [3] range_of_num(5, 9) ➞ [6, 7, 8] range_of_num(2, 11) ➞ [3, 4, 5, 6, 7, 8, 9, 10] Notes start will always be <= end. start and end are NOT included in the...
sam-germany/Python_Coding_Challange
01_Very_Easy/090.py
090.py
py
629
python
en
code
0
github-code
90
8528706543
# app.py from flask import Flask, jsonify, request, render_template from flask.wrappers import Request app = Flask(__name__) from sniffer import main global json_capture json_capture = [] @app.route('/generate', methods=['GET', 'POST']) def generate(): if request.method == 'GET': json_capture = main(15) ...
angelasofiaremolinagutierrez/netby
Proyecto/packet_sniffer/app.py
app.py
py
761
python
en
code
2
github-code
90
43983673344
from DataCollector.data_access.models import TrendAggregate, new_daily_aggregate, new_trend_aggregate, update_labels from DataCollector.data_access.repository import DataRepo from .twitter_handler import TwitterAPI from .project_utils import get_datetime_from_n_days_ago, strip_down_comment from fasttext import FastText...
durid-ah/sentiment_twitter_app
serverless-functions/DataCollector/tweets_analyzer.py
tweets_analyzer.py
py
2,280
python
en
code
0
github-code
90
18173588719
n = int(input()) c = list(input()) hrcnt = 0 rcnt = 0 for i in range(len(c)): if c[i]=='R': rcnt += 1 for i in range(len(c)): if i+1<=rcnt and c[i]=='R': hrcnt += 1 wcnt = len(c)-rcnt if rcnt==len(c) or rcnt==0: ans = 0 else: ans = rcnt-hrcnt print(ans)
Aasthaengg/IBMdataset
Python_codes/p02597/s533482233.py
s533482233.py
py
287
python
en
code
0
github-code
90
3422252640
import os, sys from flask import Flask, render_template, request, redirect, flash, redirect, url_for, Response from app import app import pymongo import secrets as sec import nationalparks as usnp from wtforms import TextField, Form, SelectField import json import folium class SearchForm(Form): autocomp = TextFiel...
tdody/NationalParks
app/views.py
views.py
py
5,333
python
en
code
0
github-code
90
19762073989
import subprocess import re from . import logger # Try to avoid calling command other than imgmag ones in order to prevent cross-os problems def _command(command): # print("Running command: " + command) # For whatever reason, close_fds=True causes the program to run reeaaally slowly. Like 2x as slow. pro...
bajuwa/ComicCompiler
comiccompiler/imgmag.py
imgmag.py
py
10,324
python
en
code
14
github-code
90
18043887679
import numpy as np h, w = map(int, input().split()) A = [input() for _ in range(h)] B = np.empty((h+1, w+1), dtype=str) for i in range(h): for j in range(w): B[i, j] = A[i][j] x = y = 0 B[y, x] = '.' while x != w-1 or y != h-1: if B[y, x+1] == B[y+1, x] == '#': print('Impossible') exit() elif B[y, x+...
Aasthaengg/IBMdataset
Python_codes/p03937/s930101078.py
s930101078.py
py
446
python
en
code
0
github-code
90
1730861346
from flask_restful import Resource from flask import session, request, jsonify import requests import os from db import * from endpoints import require_login from playhouse.shortcuts import model_to_dict class Lol(Resource): def get(self): return {"lol": 5} class Myself(Resource): @require_login ...
clarapulse/backend
endpoints/user.py
user.py
py
2,157
python
en
code
0
github-code
90
39129162079
import cv2 import numpy as np img = cv2.imread('../img/house.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) fast = cv2.FastFeatureDetector_create(50) keypoints = fast.detect(gray, None) img = cv2.drawKeypoints(img, keypoints, None) cv2.imshow('FAST', img) cv2.waitKey() cv2.destroyAllWindows()
YeonwooSung/ai_book
CV/OpenCV/match_track/kpt_fast.py
kpt_fast.py
py
302
python
en
code
17
github-code
90
1974570115
# -*- coding: utf-8 -*- """ Spell checking functions """ from typing import List def spell(word: str, engine: str = "ediz") -> List[str]: """ Provides a list of possible correct spelling of the given word. Param: word: str Word to spell check engine: str ...
thirawat69/PyThaiAddr
pythaiaddr/spell/core.py
core.py
py
2,699
python
en
code
2
github-code
90
40581821180
# 5 Реализуйте алгоритм перемешивания списка. # Из библиотеки random использовать можно только randint import random def input_list_in_order(length): i = 0 list = [] while i < length: list.append(i + 1) i += 1 return list def list_mixing(list): i = 0 while i < len(list): ...
Suxarik777/GB_Python_base
Py_HomeWork/Seminar_HomeWork_002/Ex_05_mixing_list.py
Ex_05_mixing_list.py
py
824
python
ru
code
0
github-code
90
10456212748
from django.shortcuts import render # Importing http response from django.http import HttpResponse from .models import Post posts = Post.objects.all() # Create your views here. def home(request): # lets create dictionary context = { 'posts': posts, 'title': 'Home' } return render(r...
pawansa3/django-projects
django_blog_project/blog/views.py
views.py
py
550
python
en
code
0
github-code
90
18130559320
class Node: def __init__(self,key,val): self.key=key self.val=val self.prev=self.next=None class LRUCache: def __init__(self, capacity: int): self.capacity=capacity self.cache={} #To store key to Node #left point to least Recently used node #right point...
narendrasingodia1998/LeetCode
0146-lru-cache/0146-lru-cache.py
0146-lru-cache.py
py
1,538
python
en
code
0
github-code
90
18474007919
N,X=map(int,input().split()) def n_pati(l): val = 1 for i in range(l): val = val*2+1 return val def n_layer(l): val = 1 for i in range(l): val = val*2+3 return val SUM=0 while 1: if N==1: if X in [0,1]:break elif X>=2: SUM += min(3,X-1) break L = n_layer(N) if X >= L/...
Aasthaengg/IBMdataset
Python_codes/p03209/s745199494.py
s745199494.py
py
526
python
en
code
0
github-code
90
70491654058
#冒泡排序, 复杂度O(n*n) def bubble_sort(list): for i in range(len(list)-1): exchange = False for j in range(len(list)-i-1): if list[j] > list[j+1]: list[j], list[j+1] = list[j+1], list[j] exchange = True if not exchange: return # list = [9,2,3...
brave-lizzy/Leecode_Lizzy
Order_sorts.py
Order_sorts.py
py
2,574
python
en
code
0
github-code
90
20253951327
import inspect from contextlib import closing from functools import wraps from socket import * import json import requests import time import click import logging import server_log_config times = time.ctime() logger = logging.getLogger('app2.main') # Ответы сервераa LIST_AUTH = [ { "response": 200, ...
Bulgakoff/client_server_app
hw_lesson_6/hw5/for_log/server_my.py
server_my.py
py
5,127
python
en
code
0
github-code
90
7306927448
import torch import pytorch_lightning as pl from pytorch_lightning.metrics.functional import accuracy from ..utils import utils class Model(pl.LightningModule): def __init__(self, model, criterion=None, lr=1e-3, optim="Adam",data_cov=None,zeroparams=None): super().__init__() self.model = model ...
okitouni/Learning-symmetries
sym/models/lightningbase.py
lightningbase.py
py
4,357
python
en
code
1
github-code
90
42210417125
import logging from datetime import datetime, timezone from typing import List, Optional from sqlalchemy import and_, exists from autotroph_core.google_api import GoogleApiClient from redwood_db.content import Article, Subscription from redwood_db.triage import Box, Triage from redwood_db.user import User, UserSubscr...
Summ-Technologies/forest
lib/redwood-core/src/redwood_core/content_manager.py
content_manager.py
py
13,854
python
en
code
0
github-code
90
14843581152
import numpy as np import argparse import matplotlib.pyplot as plt from matplotlib import rcParams lwidth = 4.0 plt.rc('text', usetex=True, fontsize=30) rcParams['text.latex.preamble'] = [r'\usepackage{helvet} \usepackage{sfmath}', r'\usepackage{upgreek}'] rcParams['axes.linewidth'] = 1.0*lwidth rcParams['xtick.major....
pratima-personal/umbrella-sampling
coarse-grain.py
coarse-grain.py
py
6,560
python
en
code
0
github-code
90
38421417628
import pytest from mdurocherart.contact.models import send_email from mdurocherart.models import Email emails = [ Email( email='tester@testing.com', subject='johnny bravo', body='Don\'t you think johnny bravo is buff', name='johnny bravo', ), Email( email='devloper...
DKasonde/art_portfolio_site
tests/unit/test_mail.py
test_mail.py
py
663
python
en
code
0
github-code
90
23535105645
ORD_A = ord('a') def lower_ord(c): return ord(c) - ORD_A def count_anagram_substrings(T, S): m, n, k = len(T), len(S), len(S[0]) D = {} # map from freq tables to ocurrences F = [0] * 26 # initial frequency table # traverse the f...
vitorpbarbosa7/mit_6.006
psets/ps3-template/mit_solution.py
mit_solution.py
py
698
python
en
code
0
github-code
90
10910029120
# -*- coding: utf-8 -*- """ Team Assignment 1 - part4 - FileProcess - read file windows 7 """ from datetime import datetime import json import codecs import os def GetForderls(pwd = '.'): jsonFileList = [] for dirname, dirnames, filenames in os.walk(pwd): #print(filenames) # print...
Stronglian/DataScience_TeamAssignment1
Code/FileProcess.py
FileProcess.py
py
3,189
python
en
code
0
github-code
90
15774065678
class Solution(object): def pivotIndex(self, nums): """ :type nums: List[int] :rtype: int """ # Initializing left sum as 0 and right sum as total sum left,reight=0,sum(nums) for i in range(len(nums)): # Checking wether left sum is equal to right su...
Vinay-Hundekar/Leet-Code-
LeetEasy/724. Find Pivot Index.py
724. Find Pivot Index.py
py
705
python
en
code
0
github-code
90
910443776
from keras import backend as K from layers import RegionLayer from keras import layers import numpy as np from unittest import TestCase from unittest.mock import Mock, call class TestRegionLayer(TestCase): def tearDown(self): K.clear_session() def test_split_region(self): # some RGB input im...
vitoralbiero/keras_drml_region_layer
tests/region_layer_test.py
region_layer_test.py
py
3,368
python
en
code
2
github-code
90
17959292404
def main(): nome = input("Digite seu nome: ") print("Bom dia, " + nome) if __name__ == "__main__": main() import tkinter as tk from tkinter import messagebox def mostrar_mensagem(): nome = entrada.get() if nome: mensagem = "Bom dia, " + nome messagebox.showinfo("Me...
AnaMedlyn/Python
Exemplo If_Else_for/janela de exibir.py
janela de exibir.py
py
800
python
pt
code
0
github-code
90
13718168542
import maya.cmds as cmds def addToList (*args): selection = cmds.ls (sl = True) cmds.textScrollList (customList, edit = True, append = selection) def removeFromList (*args): selection = cmds.ls (sl = True) cmds.textScrollList (customList, edit = True, removeItem = selection) def clearList (*a...
gatest1/Fall-2017
MEL Maya Scripts/Custom Outliner Script Python.py
Custom Outliner Script Python.py
py
1,283
python
en
code
0
github-code
90
25443512699
#!/usr/bin/env python import rospy from std_msgs.msg import Int64MultiArray from std_msgs.msg import Int64 def callback(msgP): msgS = Int64MultiArray() msgS=msgP.data result = msgS[0] + msgS[1] + msgS[2] pub = rospy.Publisher('chat_Summing', Int64, queue_size=10) pub.publish(result) rospy.login...
Andrey949101/LR1_1
scripts/Summing.py
Summing.py
py
470
python
en
code
0
github-code
90
17943558749
h,w = map(int,input().split()) grid = [""]*h for i in range(h): grid[i] = list(input()) # print(grid) search = [(row,col) for row in range(-1,2) for col in range(-1,2) if not(row == 0 and col == 0)] # print(search) for i in range(h): ans = "" for j in range(w): if(grid[i][j] == "."): bo...
Aasthaengg/IBMdataset
Python_codes/p03574/s590157799.py
s590157799.py
py
599
python
en
code
0
github-code
90
18331359912
from __future__ import unicode_literals from bs4 import BeautifulSoup import urllib import urllib2 import re f2 = file('depth_4.txt','a') f1 = file('depth_3.txt','r') while True: url = f1.readline() if url =="" : break if url.startswith("http://") : request = urllib2.Request(url) ...
piyush2468/PythonTextEditor
first1.py
first1.py
py
1,209
python
en
code
1
github-code
90
25255161672
import sys from collections import deque def bfs(): q = deque() q.append([0, 0]) dist[0][0] = 0 while q: x, y = q.popleft() for i in range(4): nx, ny = x + dx[i], y + dy[i] if 0<=nx<N and 0<=ny<M: if dist[nx][ny] == -1: if ar...
choinara0/Algorithm
Baekjoon/Graph Algorithm/1261번 - 알고스팟/1261번 - 알고스팟.py
1261번 - 알고스팟.py
py
789
python
en
code
0
github-code
90
73516565738
# -*- coding: utf-8 -*- """ Created on Thu Apr 7 15:24:06 2022 @author: ali.uzun """ import sys #sys.path.append("\\\\fs1\\Docs2\\ali.uzun\\My Documents\\My Files\\Scripts\\Python\\III-V Scripts\\src\\") import pandas as pd from datetime import datetime from src.Keithley26xx_GPIB import smu26xx from ...
uzunali/III-V-Python-Scripts-V2.1
main.py
main.py
py
11,566
python
en
code
0
github-code
90
21344197487
import sys sys.path.insert(1, r"C:\Users\walkerl\Documents\code\RC_BuildingSimulator\rc_simulator") import numpy as np import pandas as pd import matplotlib.pyplot as plt from building_physics import Building import supply_system import emission_system from radiation import Location from radiation import Window from ...
Linwal/proof_of_concept
hourly_simulation.py
hourly_simulation.py
py
3,793
python
en
code
0
github-code
90
23834693717
#!/usr/bin/python3 import sys import os AOSP_ROOT = os.environ["L_AOSP_ROOT"] AOSP_OUT_DIR = os.environ["L_AOSP_OUT_DIR"] if (not AOSP_ROOT.startswith("/") or not AOSP_OUT_DIR.startswith("/")): sys.exit("Invalid environment variables") AOSPLESS_OUT_DIR = "aospless/" REL_PREFIX = "[BASE_DIR]/" include_dirs = [] ob...
GloDroid/aospext
tools/gen_aospless_dir.py
gen_aospless_dir.py
py
4,153
python
en
code
1
github-code
90
41369827244
import pandas as pd import matplotlib.pyplot as plt import numpy as np import math import copy from scipy.optimize import minimize class HoltWintersWithoutLeapYear: def __init__(self, ts, horizon): self.ts = ts self.horizon = horizon self.is_training = True self.year_seasonality = n...
Henkeboi/tdt4137
holt_winters_without_leap_year.py
holt_winters_without_leap_year.py
py
9,332
python
en
code
0
github-code
90
22469542847
import cv2 import os capture = cv2.VideoCapture("8.mp4") i = 0 directory = './crashedCars' os.chdir(directory) while True: ret, frame = capture.read() cv2.imwrite("frame8_%d.jpg" % i, frame) i = i + 1
Rounak-Paul/car-crash-ann
video2img/video2img.py
video2img.py
py
213
python
en
code
0
github-code
90
20301440506
import asyncio import os import shutil import sys from unittest import TestCase, mock import asyncpg import migo DATABASE_DSN = os.getenv('DATABASE_DSN', 'postgresql://postgres:postgres@localhost:5432/postgres') MIGRATIONS_DIR = 'sql-test' class BaseTestCase(TestCase): """ This class can be used as a base ...
TunedMystic/migo
tests.py
tests.py
py
14,927
python
en
code
1
github-code
90
18333146069
S = input() K = int(input()) if len(set(S)) == 1: print(len(S)*K//2) else: i, count1 = 1, 0 while i < len(S): if S[i] == S[i-1]: count1 += 1 i += 2 else: i += 1 ss = S*2 i, count2 = 1, 0 while i < len(ss): if ss[i] == ss[i-1]: ...
Aasthaengg/IBMdataset
Python_codes/p02891/s217130737.py
s217130737.py
py
429
python
en
code
0
github-code
90
16996369322
import numpy as np import matplotlib.pyplot as plt import pandas as pd import math import matplotlib.patches as pat from matplotlib.animation import FuncAnimation import datetime as datetime import time from scipy import stats import os # function def mainframe(file, nrows, barn_file, bed_dir, hours, hours_to_next_mil...
EmSk6442/koprojekt
functions.py
functions.py
py
16,623
python
en
code
1
github-code
90
36041472400
import pygame import numpy as np import aiinpy as ai PopulationSize = 1000 InToHid1 = ai.neuroevolution(4, 6, MutationRate=0.1, PopulationSize=PopulationSize, Activation='Identity') Hid1ToOut = ai.neuroevolution(6, 3, MutationRate=0.1, PopulationSize=PopulationSize, Activation='Identity') pygame.init() pygame.displa...
seanmabli/dinogame
Python_Ai/DinoGame-withdisplay.py
DinoGame-withdisplay.py
py
5,687
python
en
code
0
github-code
90
23296849738
# -*- coding: UTF-8 -*- # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def minDepth(self, root): if root is None: return 0 re...
OhOHOh/LeetCodePractice
python/No111.py
No111.py
py
668
python
en
code
0
github-code
90
32800996180
# -*- coding: utf-8 -*- """Top-level package for krtd.""" __author__ = "Benjamin D. Lee" __email__ = "benjamindlee@me.com" from .__version__ import __version__ from .krtd import ( krtd, codon_rtd, distance_between_occurrences, seq_to_array, rtd_metric_dict_to_array, )
Lab41/krtd
krtd/__init__.py
__init__.py
py
292
python
en
code
0
github-code
90
70022794856
import math import os import random import sys import cv2 import numpy as np import torch cwd = os.getcwd() sys.path.append(f"{cwd}/nerf-pytorch") from load_llff import load_llff_data from load_deepvoxels import load_dv_data from load_blender import load_blender_data def sample_rays_to_render(args, target, N_rand, H...
dxyang/6869_nerf
utils.py
utils.py
py
9,425
python
en
code
0
github-code
90
30282021079
import os import sys import time import vtk import fiona import numpy as np from shapely.geometry import shape, mapping, Polygon import rasterio from rasterio.features import rasterize from typing import Dict, List, Tuple """ Command lines: python "C:/Users/lwlassi/source/repos/lwarsta/STYX/python/vtk_to_vector_and_ra...
lwarsta/STYX
python/vtk_to_vector_and_raster_files.py
vtk_to_vector_and_raster_files.py
py
13,772
python
en
code
0
github-code
90
32057875612
from datetime import datetime, date class User(object): def __init__(self, name, birthday): self.name = name self.birthday = birthday self._age = 0 # property 可以将方法 变成 属性 @property def age(self): return datetime.now().year - self.birthday.year @age.setter def ...
xiaoweigege/Python_senior
chapter07/1. property 动态属性.py
1. property 动态属性.py
py
514
python
en
code
1
github-code
90
16305596072
s = input("Enter String: ") countv = 0 countc = 0 n = ["A","E","I","O","U","a","e","i","o","u"] for a in s: if a in n: countv = countv+1 else: countc = countc+1 print("No of vowels:",countv) print("No of consonants:",countc)
shubhsharad/Random_python_programs
No of vowels and consonants.py
No of vowels and consonants.py
py
251
python
en
code
0
github-code
90
18381512269
N, K = [int(x) for x in input().split()] ok = False if K <= (N - 1)*(N - 2)//2: ok = True e = N*(N - 1)//2 - K edge = [] cnt = 0 done = False for i in range(1, N): for j in range(i + 1, N + 1): edge.append([i, j]) cnt += 1 if cnt == e: ...
Aasthaengg/IBMdataset
Python_codes/p02997/s187597183.py
s187597183.py
py
514
python
en
code
0
github-code
90
43448430445
#!/usr/bin/env python3 # qPlan.py : queuePlanner import os import warnings from datetime import datetime, timedelta import numpy as np import pandas as pd from astropy import units as u from astropy.coordinates import SkyCoord from astropy.table import Table warnings.filterwarnings("ignore") def make_schedule_tabl...
Subaru-PFS/pfs_obsproc_planning_tools
src/pfs_obsproc_planning/qPlan.py
qPlan.py
py
10,256
python
en
code
0
github-code
90
29087494374
from lConnect import lUtils def testDevice(utils): IP="10.82.43.189" DPW="admin1" handler=utils.getDeviceHandler(IP,DPW) ipline=utils.runCommand(handler, "/info/sys/mgmt", "System#", "255.255") print("IP line is: " ,ipline) ipline=utils.runCommand(handler, "/maint/debug/prepdbg/watcher dis", "debug#...
nfvguru/myLearn
PythonProjects/trial/test.py
test.py
py
871
python
en
code
0
github-code
90
33409433987
import sys import fire from pathlib import Path from omegaconf import DictConfig from calf import run_experiment def parser(cfg: DictConfig): from .test_parser import train_parser, test_parser if cfg.mode == "train": train_parser(cfg=cfg, lang=cfg.src_lang) elif cfg.mode == "test": test_pa...
ningyuxu/calf
exps/cl_syntactic_diff_mbert/run.py
run.py
py
1,149
python
en
code
0
github-code
90
18273376959
n = int( input() ) a = list( map( int, input().split() ) ) cnt = {} for a_i in a: try: cnt[ a_i ] print( "NO" ) break except KeyError: cnt[ a_i ] = 1 else: print( "YES" )
Aasthaengg/IBMdataset
Python_codes/p02779/s120281915.py
s120281915.py
py
216
python
en
code
0
github-code
90
34179502901
import re from urllib import request import requests from bs4 import BeautifulSoup site = 'https://wiki.melvoridle.com/index.php?title=Mining' response = requests.get(site) soup = BeautifulSoup(response.text, 'html.parser') img_tags = soup.find_all('img') headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0;...
foxwhite25/rpgthingy
crawler/mine.py
mine.py
py
1,118
python
en
code
16
github-code
90
71285275497
with open('input.txt', 'r', encoding='utf8') as inF: line, lines = int(inF.readline()), inF.readlines() k, c, Sl, Cl = 1, int(lines[0]), [], set() for i in range(line): school = set() while k < c + 1: school.add(*tuple(lines[k].split())) k += 1 Sl.append(school) Cl |= Sl[i] Sl[0]...
Dudermont/Coursera
7_week/Polyglots.py
Polyglots.py
py
452
python
en
code
0
github-code
90
8292104976
import discord from discord.ext import commands import os import random from discord import Permissions client = commands.Bot(command_prefix="!", intents = discord.Intents.all()) token =("MTAxMDk4NTg5NjgwNTQxMjk4NA.G6WHlM.R1JoW1bwFcu3_UbTRP8H03uCm_na-Fhqpxk5Gc") #input your bot token here CHANNEL_NAMES = ['Nu...
MyStuffYT/okthisisjustpredsbot
main.py
main.py
py
5,969
python
en
code
0
github-code
90
17757058200
# coding=utf-8 import os def loadSuiteFiles(path, start="test_", end=".yaml"): """加载用例文件""" f = [] if os.path.exists(path): print(path) if os.path.isfile(path) and os.path.basename(path).startswith(start) and os.path.basename(path).endswith(end): f.append(path) ret...
jiangyd/dtest
dtest/util.py
util.py
py
654
python
en
code
0
github-code
90
38463225756
import os import shutil import pandas import numpy as np from scipy import stats # -------------------------------------------------------- # # ***Oxford Mathematical Brain Modeling Group*** # # FSL raw connectivity matrices, symmetrization, and output # to Cosica format for further thresholding using 2-Cosica-Thr...
PavanChaggar/Connectomes
network-thresholding/1-FSL-to-Cosica.py
1-FSL-to-Cosica.py
py
7,183
python
en
code
1
github-code
90
15815948980
#Author: Thomas Fenaroli #Date: 01/19/2021 #Purpose: Create a chalkboard that allows you to change the color of your marker from cs1lib import * #global variables i = 0 old_x = 0 old_y = 0 x = 0 y = 0 draw = False #starts drawing upon press def press(mx, my): global draw draw = True #continues drawing/not d...
tfenaroli/dartmouth-cs1
SA4/chalkboard.py
chalkboard.py
py
1,345
python
en
code
0
github-code
90
25769516413
from texte import genere_phrase, finalise_phrase import random import speake3 phrases = [] if __name__ == '__main__': for x in range(0, 100): phrase = genere_phrase()['contenu'] phrases.append(finalise_phrase(phrase)) print(phrases[-1]) e = speake3.Speake() e.set('voice', '...
ewenak/generation-texte
voix_texte.py
voix_texte.py
py
405
python
en
code
0
github-code
90
72840420778
from main import * from best import * import random numlist = [1,2,3,4,5,6,7,8,9,10] symbollist = ["+","-","*","/"] print("Welcome to Equation Check") show_best() name = input("What your name?\n> ") login(name) lv = input("Choose your level\nlevel 1 have 2 number 1 symbol\nlevel 2 have 3 number 2 symbol\n> ") print("\...
gritsp/EquationCheck
play.py
play.py
py
1,145
python
en
code
0
github-code
90
34805864100
import logging import json import base64 import os import time import requests class AsusIp: def __init__(self): self.asus_router_ip = os.getenv("ASUS_ROUTER_IP") self.headers = { "user-Agent": "asusrouter-Android-DUTUtil-1.0.0.245", } self.login() def login(self):...
RyuunosukeDS3/asus-router-data-stream
asus_api/asus_api.py
asus_api.py
py
3,884
python
en
code
0
github-code
90
35225119429
# Test methods with long descriptive names can omit docstrings # pylint: disable=missing-docstring import unittest import numpy as np from Orange.classification import LogisticRegressionLearner from Orange.data import Table, Domain, ContinuousVariable, DiscreteVariable from Orange.statistics.util import stats from Or...
biolab/orange3
Orange/widgets/model/tests/test_owlogisticregression.py
test_owlogisticregression.py
py
5,800
python
en
code
4,360
github-code
90
6891244521
# https://arcade.academy/examples/array_backed_grid_sprites_1.html#array-backed-grid-sprites-1 """ Array Backed Grid Shown By Sprites Show how to use a two-dimensional list/array to back the display of a grid on-screen. This version syncs the grid to the sprite list in one go using resync_grid_with_sprites. If Pytho...
kopp/arcade_games
schatzsuche.py
schatzsuche.py
py
7,920
python
en
code
0
github-code
90
6189896806
from setuptools import setup, find_packages import os version = '0.7' def read(*args): path = os.path.join(*args) try: return open(path).read() except: pass return '' setup(name='oh-my-vim', version=version, description="Vim plugin manager and Vim related stuff", lo...
gawel/oh-my-vim
setup.py
setup.py
py
1,207
python
en
code
150
github-code
90
17216656190
import discord import asyncio import re async def prune(client, message): input = message.content if len(message.mentions) == 0: number = list(map(int, re.findall('\d+', input))) await client.purge_from(message.channel, limit=number[0]) await client.send_message(message.channel, "Prunin...
rjpals/stanton-discord-bot
DiscordBot/help.py
help.py
py
1,308
python
en
code
0
github-code
90
17970698159
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) ret = [[0] * w for i in range(h)] line = [] for i, item in enumerate(a): line.extend([i+1] * item) for i, item in enumerate(line): sho = i // w amari = i % w if sho % 2 == 0: ret[sho][amari] = item else:...
Aasthaengg/IBMdataset
Python_codes/p03638/s230101521.py
s230101521.py
py
410
python
en
code
0
github-code
90
16173030254
# SPDX-License-Identifier: Apache-2.0 # Licensed to the Ed-Fi Alliance under one or more agreements. # The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. # See the LICENSE and NOTICES files in the project root for more information. from edfi_performance_test.api.client.ed_fi_api_client...
Ed-Fi-Exchange-OSS/Suite-3-Performance-Testing
src/edfi-performance-test/edfi_performance_test/api/client/v5/contact.py
contact.py
py
2,344
python
en
code
1
github-code
90
2394753502
from pico2d import * import math open_canvas() grass = load_image('grass.png') character=load_image('character.png') delay(1) def renderAll(x,y): clear_canvas_now() grass.draw_now(800/2,30) character.draw_now(x, y) delay(0.01) def runCircle(): cx, cy, r = 400,300,200 for degree in range(0+27...
crapa36/Drill02_Good
character_grass.py
character_grass.py
py
894
python
en
code
0
github-code
90
27647260304
from collections import OrderedDict import os # skdaccess imports from skdaccess.framework.data_class import DataFetcherCache, ImageWrapper from skdaccess.utilities.image_util import SplineLatLon from skdaccess.utilities.uavsar_util import readUAVSARMetadata # 3rd party imports import numpy as np class DataFetcher(...
MITHaystack/scikit-dataaccess
skdaccess/geo/uavsar/cache/data_fetcher.py
data_fetcher.py
py
5,248
python
en
code
44
github-code
90
17985035859
s = input() n = len(s) chars = [chr(i) for i in range(97, 97+26)] res = 1 << 30 for c in chars: cnt = 0 t = s while len(set(list(t))) > 1: u = [] for i in range(len(t) - 1): if t[i] == c or t[i + 1] == c: u.append(c) else: u.append(t[i]) cnt += 1 t = ''.join(u) res = min(res, cnt) print(res...
Aasthaengg/IBMdataset
Python_codes/p03687/s994522663.py
s994522663.py
py
322
python
en
code
0
github-code
90
10052648033
from banana.templatetags.units import units_map from django import template register = template.Library() @register.inclusion_tag('tags/flux_units_dropdown.html',takes_context=True) def flux_units_dropdown(context): simple_units_map = units_map.copy() del simple_units_map[None] context['units_map'] = simp...
transientskp/banana
banana/templatetags/flux_units_dropdown.py
flux_units_dropdown.py
py
352
python
en
code
4
github-code
90
13334913474
import sys from datetime import timedelta from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent PROJECT_ROOT = PROJECT_ROOT = Path(__file__).parent.parent sys.path.append(str(PROJECT_ROOT / 'apps')) SECRET_KEY = "django-insecure-x%09*2*!d@+5)z3kreq9wcb7l-)q8(%cs)+@7syzwomwd8%==3" DEBUG = True ...
madjar-code/Career-Routes
backend/backend/settings.py
settings.py
py
4,126
python
en
code
0
github-code
90
1622707275
import os import sys import optuna import logging import argparse from experiment import experiment from containers import Hyperparameters def hyperparameter_tuning( base_path: str, data_path: str, model_type: str, language: str, num_symbol_features: int, num_source_features: int, autoreg...
LGirrbach/sigmorphon-2023-inflection
hyperparameter_tuning.py
hyperparameter_tuning.py
py
3,556
python
en
code
0
github-code
90
10134424112
from wordcloud import WordCloud from PIL import Image import numpy as np text = '' with open("kakaotalk.txt", "r", encoding="utf-8") as f: lines = f.readlines() for line in lines[5:]: if '] [' in line: text += line.split('] ')[2].replace('하고','').replace('그냥','').replace('이제','').r...
jjin30/python_spartacodingclub
wrprac.py
wrprac.py
py
909
python
en
code
0
github-code
90
9684333303
from typing import Optional from sqlalchemy import create_engine from sqlalchemy import update, delete from sqlalchemy.orm import sessionmaker from utils.db_api.base import Base from utils.db_api.models import Users db_string = r"sqlite:///database.db" db = create_engine(db_string) Session = sessionmaker(db) ses...
KarimovMurodilla/converter-text-bot
utils/misc/connection.py
connection.py
py
1,091
python
en
code
1
github-code
90
6853683892
import pickle with open('../static/data/final_network_filtered.graphml', encoding='utf-8') as network, open('../static/data/edge_list.tsv', 'w', encoding='utf-8') as edge_list, open('../static/data/node2word.pickle', 'rb') as node2word_pickle: node2word = pickle.load(node2word_pickle) for idx, line in enumera...
dlsucomet/filwordnet-portal
src/preprocessing/generate-edge-list.py
generate-edge-list.py
py
695
python
en
code
0
github-code
90
18394868119
# スタート地点からDFSで大きい順に入れていけば、最も大きい数以外は得点を得られる N = int(input()) E = [[] for i in range(N)] for i in range(N-1): a,b = map(int,input().split()) E[a-1].append(b-1) E[b-1].append(a-1) # 得点を大きい順に並べる C = sorted(list(map(int,input().split())))[::-1] ans = [-1 for i in range(N)] # -1は未訪問 point = sum(C[1:]) from collecti...
Aasthaengg/IBMdataset
Python_codes/p03026/s681953314.py
s681953314.py
py
704
python
en
code
0
github-code
90
26128179569
import jieba from functools import reduce from operator import itemgetter, add # 信息的冗余程度与每个符号出现的概率有关 # 不确定性函数关于概率单调递减、独立符号产生的不确定性等于各自不确定之和 # f(p1, p2)=,f(p1) + f(p2) # f(p) = -log(p)满足: log(p1*p2) = log(p1) + log(p2) # 信源的平均不确定性为信息熵,假定各符号相互独立可得:H(U) = ∑plogp # 系统混乱则信息熵大(系统中各信号出现概率相同时信息熵最大) def fun1(): # 全模式 ...
dwdb/python-notes
module/__jieba.py
__jieba.py
py
5,012
python
en
code
0
github-code
90
20708701052
# coding=utf-8 from deepctr.feature_column import SparseFeat, VarLenSparseFeat, DenseFeat, get_feature_names # from lightgbm RootPath = r'D:\Great_job_of_teammate' import os import pandas as pd import numpy as np import tensorflow as tf import time import pickle from tensorflow.python.keras.models import load_model fro...
Jiangqinhan/GBDT_NN_21.06_now
DeepFM.py
DeepFM.py
py
8,009
python
en
code
0
github-code
90
23188025786
from datetime import date from typing import Optional, Tuple import requests from fastapi import Depends, HTTPException, Query from sqlmodel import Session, select, union_all from app.config import settings from app.tweets_common.decorators import timed_lru_cache from app.tweets_common.helper_functions import get_fil...
naamiinepal/covid-tweet-classification
server/app/tweets_common/routes.py
routes.py
py
2,378
python
en
code
7
github-code
90
10747421387
import cv2 import sys from matplotlib import pyplot as plt import numpy as np import argparse import io def set_manual_exposure(hidraw, value): MAX_EXPOSURE=300000 if value >= MAX_EXPOSURE: print(f'Exposure must be less than {MAX_EXPOSURE} (is {value})') return f = io.open(hidraw, 'wb', buf...
eichenberger/stereo-svo-slam
test/econ_record_video.py
econ_record_video.py
py
1,890
python
en
code
11
github-code
90
10488032602
import horseman.response import jsonschema from roughrider.predicate.errors import HTTPConstraintError from api import models def error_to_response(error: HTTPConstraintError): return horseman.response.Response.to_json( error.status, body={'error': error.message}) def json_only(request: Request): if...
HorsemanWSGI/examples
sql_api/src/api/predicates.py
predicates.py
py
942
python
en
code
0
github-code
90
18204026069
def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a dum = prime_factorize(int(input())) dum_len = l...
Aasthaengg/IBMdataset
Python_codes/p02660/s248987384.py
s248987384.py
py
608
python
en
code
0
github-code
90