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
43204442062
import psycopg2 from flask import Flask, redirect, url_for, render_template, request, session, flash from datetime import timedelta from datetime import date today = date.today() print("Today's date:", today) #connect to the local host db con = psycopg2.connect ( host = "database-finalproject.cwap51qwtcts.us-west-2...
ejcanoy/CSS475
demo.py
demo.py
py
10,078
python
en
code
0
github-code
90
14497267856
from __future__ import with_statement from logging import getLogger import os, warnings try: from pkg_resources import resource_filename except ImportError: resource_filename = None from otp.ai.passlib import hash from otp.ai.passlib.context import CryptContext, CryptPolicy, LazyCryptContext from otp.ai.passli...
TTOFFLINE-LEAK/ttoffline
v2.5.7/otp/ai/passlib/tests/test_context_deprecated.py
test_context_deprecated.py
py
19,351
python
en
code
3
github-code
90
11160368514
# example 5.16 # now we're going to combine our sandwich and prices list together so they are easier to manage menu = [["chipotle chicken", 10], ["reuben", 11], ["ham and cheese", 12], ["meatball", 13], ["monte cristo", 14]] print(menu)
thetomosaurus/133yLists
example_5_16.py
example_5_16.py
py
279
python
en
code
0
github-code
90
11291067619
from airflow import DAG from airflow.contrib.sensors.file_sensor import FileSensor from airflow.operators.bash_operator import BashOperator from datetime import datetime, timedelta seven_days_ago = datetime.combine(datetime.today() - timedelta(1), datetime.min.time()) default_args = ...
turnerlabs/airflow_stacks
examples/filesensing.py
filesensing.py
py
1,010
python
en
code
3
github-code
90
21686986880
import numpy as np import cv2 from pyimagesearch.shapedetector import ShapeDetector import imutils from Design.Design import Design from Tambou.tambou import Tambou from HandleCollision.HandleCollision import HandleCollision import simpleaudio as sa #image1=cv2.imread('test.jpg') #image2=cv2.imread('tt.png'...
JBAltidor/Computer_Vision
Air_Drums/opencv.py
opencv.py
py
4,704
python
en
code
0
github-code
90
13793214239
import asyncio from sqlalchemy import select from models import User, Post, Like, session async def update_users_likes(): async with session() as session: async with session.begin(): users = await session.execute( select(User).join(Post).outerjoin(Like).group_by(User).having(Li...
nesonzahartms/tms
lesson18_19_sqlalchemy/homework2.py
homework2.py
py
1,108
python
en
code
0
github-code
90
18212391969
import math from collections import deque N = int(input()) a = [] b = [] for i in range(N): i1, i2 = map(int, input().split()) g = math.gcd(i1,i2) if g == 0: a.append(i1) b.append(i2) continue x = i1 // g y = i2 // g if x < 0: x = - x y = - y a.appe...
Aasthaengg/IBMdataset
Python_codes/p02679/s586005944.py
s586005944.py
py
983
python
en
code
0
github-code
90
14227339738
# # Imports # import random # # Global variables # capitals = {"France": "Paris", "Germany": "Berlin", "Spain":"Madrid"} # List inside list # travel_log = { # "France":["Paris"., "Marseille", "Clermont", "Corsiga"], # "Spain":["Malaga", "Granada", "Cordoba"], # ...
fjpolo/Udemy100DaysOfCodeTheCompletePyhtonProBootcamp
Day009/mainNesting.py
mainNesting.py
py
1,277
python
en
code
8
github-code
90
18381888869
n,k=map(int,input().split()) if k>(n-1)*(n-2)//2: print(-1) else: count=0 now=2 ans=[] for i in range(2,n+1): ans.append([1,i]) now1=2 while count<(n-1)*(n-2)//2-k: count+=1 now1+=1 if now1==n+1: now+=1 now1=now+1 ans.append([now,now1]) print(len(ans)) for i in ans: ...
Aasthaengg/IBMdataset
Python_codes/p02997/s624436629.py
s624436629.py
py
337
python
en
code
0
github-code
90
5939686530
from controller import Robot from controller import DistanceSensor, Camera if __name__ == "__main__": robot = Robot() timestep = int(64) max_speed = 6.28 motor_1 = robot.getDevice('motor1') motor_2 = robot.getDevice('motor2') motor_3 = robot.getDevice('motor3') motor_4 = robot.g...
AlexanderBrecko/Intelligent-Robotics-Brecko
Webots/robot.py
robot.py
py
2,115
python
en
code
0
github-code
90
1919650924
#time: o(n+m) #space: o(n+m) class Solution: def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]: # Creating a map nums1Idx and mapping values to their indices nums1Idx = {} for i, n in enumerate(nums1): nums1Idx[n] = i # Create a result vector ...
mohdabdulrahman297/Leetcode
0496-next-greater-element-i/0496-next-greater-element-i.py
0496-next-greater-element-i.py
py
1,331
python
en
code
0
github-code
90
9561833481
from bs4 import BeautifulSoup import numpy as np import requests import shelve s_out = shelve.open('puzzles') url_base = 'https://nine.websudoku.com/?' levels = range(1, 5) puzzle_ids = range(10) for level in levels: for puzzle_id in puzzle_ids: print(level, puzzle_id) url = url_base + 'level=%i&s...
kclements3/sudoku_solver
get_puzzle.py
get_puzzle.py
py
901
python
en
code
0
github-code
90
23453786873
#!/usr/bin/python3 BaseGeometry = __import__("7-base_geometry").BaseGeometry class Rectangle(BaseGeometry): """ Rectangle - Defines a Rectangle """ def __init__(self, width, height): """ __init__ - initializes the rectangle """ self.integer_validator("width", width) self.integer_vali...
jogden4195/holbertonschool-higher_level_programming
0x0A-python-inheritance/8-rectangle.py
8-rectangle.py
py
404
python
en
code
0
github-code
90
636822362
import sys, time import numpy as np from PIL import Image from tqdm import tqdm from numba import njit np.set_printoptions(threshold=sys.maxsize) @njit def optimized_ray_triangle_intersection(origin, direction, triangle): epsilon = 1e-6 v0, v1, v2 = triangle edge1, edge2 = v1 - v0, v2 - v0 h = np.cros...
grantcary/little-engine
littleengine/render_experimental.py
render_experimental.py
py
11,912
python
en
code
0
github-code
90
73620598378
import numpy as np import cayley # # Main logic # def finite(supord=-1): """Small groups class decorator supord - count of operations""" # now I realize only finite groups, but this can help in writing more complicated code def decorator(cat): # append the list of ta...
Reklle/spbau
abstractpy/cat.py
cat.py
py
2,878
python
en
code
1
github-code
90
27309409681
from gold.statistic.MagicStatFactory import MagicStatFactory from gold.statistic.RawDataStat import RawDataStat from gold.statistic.Statistic import Statistic, StatisticSplittable from gold.track.TrackFormat import TrackFormatReq from urllib import quote from gold.util.CustomExceptions import ShouldNotOccurError from ...
uio-bmi/track_rand
lib/hb/quick/statistic/TrackWriterStat.py
TrackWriterStat.py
py
1,597
python
en
code
1
github-code
90
43969195764
# -*- coding: utf-8 -*- # @Time : 2020-07-18 1:10 AM # @Author : Yolanda (Yiqi) Zhi # @FileName: sudoku_gui.py # @Description: A sudoku game with clock. # @Github: DurianZealot import sys import time import pygame from math import sqrt from sudoku_text import * # initialize the font module pygame.font.init() # ini...
DurianZealot/sudoku
sudoku_gui/sudoku_gui.py
sudoku_gui.py
py
21,062
python
en
code
0
github-code
90
38358921008
# Gage Hilyard # Question 1 score_differences = {} score_differences["October 7, 2017"] = 8 score_differences["October 14, 2017"] = -12 score_differences["October 21, 2017"] = 3 wins = 0 losses = 0 for date, value in score_differences.items(): if int(value) > 0: wins += 1 else: ...
Oxmoon/gagehilyard
OldPythonCourses/Gage-Hilyard-Lab9.py
Gage-Hilyard-Lab9.py
py
870
python
en
code
0
github-code
90
42938301533
class ListNode: def __init__(self, val=0, prev=None, next=None): self.val = val self.prev = prev self.next = next if __name__ == '__main__': input_str = input() input_num = input() input_num = int(input_num) cur_list = ['' for i in range(input_num)] for id...
sungjinseo/codingtest
boj/1406.py
1406.py
py
1,850
python
en
code
0
github-code
90
4919764887
#!/usr/bin/env python3 from matasano1 import xor_with_single_byte, bruteforce_single_xor def run(test_string): minimum_index = bruteforce_single_xor(test_string) decoded_text = xor_with_single_byte(test_string, ord(minimum_index)).decode('utf-8') print('Likeliest solution: %s' % minimum_index) print('...
TWoerner94/matasano-cryptopals-solutions
03-single-byte-xor-cipher.py
03-single-byte-xor-cipher.py
py
479
python
en
code
0
github-code
90
39128599869
import cv2 import numpy as np img_fg = cv2.imread('../img/opencv_logo.png', cv2.IMREAD_UNCHANGED) img_bg = cv2.imread('../img/girl.jpg') _, mask = cv2.threshold(img_fg[:,:,3], 1, 255, cv2.THRESH_BINARY) mask_inv = cv2.bitwise_not(mask) img_fg = cv2.cvtColor(img_fg, cv2.COLOR_BGRA2BGR) h, w = img_fg.shape[:2] roi ...
YeonwooSung/ai_book
CV/OpenCV/image_processing/addition_rgba_mask.py
addition_rgba_mask.py
py
747
python
en
code
17
github-code
90
23800915238
import sys from collections import deque def push(heap, data): if len(heap) == 0: heap.append(data) return else: child = len(heap)+1 parent = child // 2 heap.append(int(0)) while child > 1: if data > heap[int(parent)-1]: h...
723poil/boj
백준/Silver/11279. 최대 힙/최대 힙.py
최대 힙.py
py
1,242
python
en
code
0
github-code
90
18416401569
import sys def solve(): readline = sys.stdin.buffer.readline mod = 10 ** 9 + 7 n = int(readline()) s = str(readline().rstrip().decode('utf-8')) k = int(readline()) r = s[k-1] ans = [] for i in range(n): if s[i] != r: ans.append("*") else: ans.app...
Aasthaengg/IBMdataset
Python_codes/p03068/s369719893.py
s369719893.py
py
392
python
en
code
0
github-code
90
71165101416
import torch import torch.nn as nn from torch.nn import init from torchvision import models from torch.autograd import Variable import torch.nn.functional as F import numpy as np from torchvision.utils import save_image ###################################################################### def weights_init_kaiming(m):...
jpainam/self_attention_grid
model.py
model.py
py
4,913
python
en
code
8
github-code
90
26965781087
import argparse import logging import atexit from biweeklybudget.models.projects import Project, BoMItem from biweeklybudget.db import init_db, db_session, cleanup_db from biweeklybudget.cliutils import set_log_debug, set_log_info from wishlist.core import Wishlist logger = logging.getLogger(__name__) # suppress re...
jantman/biweeklybudget
biweeklybudget/wishlist2project.py
wishlist2project.py
py
6,740
python
en
code
87
github-code
90
18249581219
def main(): n = int(input()) a_list = list(map(int, input().split())) num_list = [0] * n # 各番号が書かれたボールが何個あるか method_list = [0] * n # 同じ番号が書かれた異なる2つのボールを選ぶ方法 for a in a_list: num_list[a - 1] += 1 for i in range(n): b = num_list[i] if b >= 2: method_list[i] ...
Aasthaengg/IBMdataset
Python_codes/p02732/s719428498.py
s719428498.py
py
792
python
ja
code
0
github-code
90
259272638
import sys import cozmo import datetime import pickle import time import re from datetime import datetime from cozmo.util import degrees, distance_mm, speed_mmps from checker_cozmo import RobotStateDisplay import numpy as np from skimage import io, feature, filters, exposure, color from sklearn import svm, m...
EtashGuha/Robot2
lab2.py
lab2.py
py
5,854
python
en
code
0
github-code
90
39190644646
"""Module for verifying reddit account email""" import logging from typing import Optional import requests from tempmail import EMail from fake_useragent import UserAgent from .config import EMAIL_MESSAGE_WAIT_TIMEOUT_S from .exceptions import EmailVerificationException from .utils import Proxy USER_AGENT = UserAge...
cubicbyte/reddit-account-generator
reddit_account_generator/_verifier.py
_verifier.py
py
2,593
python
en
code
25
github-code
90
9517577516
import os import streamlit as st import streamlit.components.v1 as components from typing import Any _DEVELOP_MODE = os.getenv('STREAMLIT_ANTD_DEVELOP_MODE') == 'true' if _DEVELOP_MODE: _component_func = components.declare_component( "streamlit_antd_cascader", url="http://localhost:3000", ) e...
pragmatic-streamlit/streamlit-antd
streamlit_antd/cascader/__init__.py
__init__.py
py
2,706
python
en
code
5
github-code
90
9108673311
from overloading import overload from core.src import userpool from entities.timesheet.base import Base ENTITY = 'timesheet' class Log: """ This class is to log time sheets for the selected task """ def __init__(self, timesheet): self.timesheet = timesheet self.request = timesheet.r...
git4rajesh/python-learnings
AST_GraphDB/study/autobots/entities/timesheet/log.py
log.py
py
3,776
python
en
code
0
github-code
90
21996307292
import mrcfile import numpy import tempfile import time import guanaco from math import pi __all__ = ["correct_file", "correct_projections"] def get_centre(shape, centre, sinogram_order=True): if not sinogram_order: shape = list(shape) shape[0], shape[-2] = shape[-2], shape[0] if centre is N...
jmp1985/guanaco
src/guanaco/detail/correct.py
correct.py
py
11,464
python
en
code
0
github-code
90
70193379176
# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab import sys import unittest import gi.overrides import gi.module import gi.importer from gi.repository import Regress class TestOverrides(unittest.TestCase): def test_non_gi(self): class MyClass: pass ...
GNOME/pygobject
tests/test_import_machinery.py
test_import_machinery.py
py
5,420
python
en
code
144
github-code
90
31119773158
import numpy as np import pandas as pd def total_time(start, duration): #сложение часов st = list(map(lambda x: int(x), start.split(':'))) dur = list(map(lambda x: int(x), duration.split(':'))) a = [st[0] + dur[0],st[1] + dur[1]] if a[1]>= 60: a[0] += 1 a[1] -= 60 if a[0] ...
tsyploff/rossiya-airlines
air_modules.py
air_modules.py
py
3,447
python
ru
code
0
github-code
90
18502984599
import sys import bisect def input(): return sys.stdin.readline().rstrip() def main(): N, K = map(int, input().split()) X = list(map(int, input().split())) S = [] ans = 10 ** 9 + 7 start = bisect.bisect(X, 0) for i in range(min(start+1,K+1)): temp = 0 if N - start < K-i...
Aasthaengg/IBMdataset
Python_codes/p03274/s720745980.py
s720745980.py
py
875
python
en
code
0
github-code
90
1281626115
from ex115.lib.interface import * def arquivoexiste(nome): try: a = open(nome, 'rt') a.close() except FileNotFoundError: return False else: return True def criararquivo(nome): try: a = open(nome, 'wt+') # criar um n...
PolicarpoDi/ExerciciosMundo3Python
ex115/lib/arquivo/__init__.py
__init__.py
py
1,525
python
pt
code
0
github-code
90
74946810535
# -*- coding: utf-8 -*- """ Problem 27 - Quadratic primes Euler discovered the remarkable quadratic formula: n² + n + 41 It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 40² + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n ...
yred/euler
python/problem_027.py
problem_027.py
py
2,258
python
en
code
1
github-code
90
73647666535
from parse import * parse_string = char('"') >> \ many(noneof('"')) >= (lambda x: char ('"') >> \ unit(x)) parse_number = some(digit) >= (lambda x: unit(int(x))) symbol = oneof("!#$%&|*+-/:<=>?@^_~") initial = alpha + symbol subsequent = alpha + digit + s...
spektroskop/parse
examples.py
examples.py
py
612
python
en
code
0
github-code
90
13966234885
""" prime number methods """ import numpy as np from set_operations import powerset from math import sqrt from collections import Counter from collatz import memoize # pylint: disable=E1103 def is_prime(number): """Checks if *number* is prime.""" if number > 1: if number == 2: return Tru...
jfecroft/project_euler
prime_factorisation.py
prime_factorisation.py
py
1,690
python
en
code
0
github-code
90
3376799868
""" @Author = oumuamuanode @Time : 2022/11/10 14:27 """ from homeWork11 import product from homeWork11 import stock s = stock() def insert_data(): is_quit = 'y' while is_quit == 'y': id = input('请输入产品id:') name = input('请输入产品名称:') number = int(input('请输入产品数量:')) ...
Kyire23/LearnPython
oumuanode/HomeWork/11testmain.py
11testmain.py
py
1,692
python
en
code
0
github-code
90
13832090034
from sqlalchemy.exc import IntegrityError from sqlalchemy.orm.exc import NoResultFound from zrl.database import db_session from zrl.models import Mapping from flask import ( Blueprint, flash, render_template, request, redirect, abort ) bp = Blueprint('views', __name__, url_prefix='/') @bp.route('/zrl_edit/<int:...
zimventures/zrl
zrl/views.py
views.py
py
1,497
python
en
code
0
github-code
90
18031139769
k, s = list(map(int, input().split())) minz = max(0, s-2*k) maxz = min(s, k) def f(s, k): if k >= s: return (s+1) else: return (2*k-s)+1 ans = 0 for i in range(minz, maxz+1): ans += f(s-i, k) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03835/s131624879.py
s131624879.py
py
234
python
en
code
0
github-code
90
31722077685
import gym from gym import error, spaces, utils from gym.utils import seeding import os import pprint import math import itertools from collections import defaultdict import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set(context='poster', style='white', palette='Paired', font='sans-...
RobertTLange/gym-swarm
gym_swarm/envs/multiagent_grid_env.py
multiagent_grid_env.py
py
24,210
python
en
code
8
github-code
90
17439420390
import os from absl.testing import flagsaver from absl.testing import parameterized import tensorflow as tf from google.protobuf import text_format from tensorflow_ranking.examples.keras import antique_ragged from tensorflow_serving.apis import input_pb2 ELWC = text_format.Parse( """ context { features...
tensorflow/ranking
tensorflow_ranking/examples/keras/antique_ragged_test.py
antique_ragged_test.py
py
3,433
python
en
code
2,684
github-code
90
27968395045
from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow import os app = Flask(__name__) app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False basedir = os.path.abspath(os.path.dirname(__file__)) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os...
iksansahib/crud-python-react
api/crud.py
crud.py
py
1,397
python
en
code
0
github-code
90
18579138499
import sys from collections import deque read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: map(int, readline().split()) in_nl = lambda: list(map(int, readline().split())) in_na = lambda: map(int, read().split()) in_s = lambda: readline().rstrip().decode('...
Aasthaengg/IBMdataset
Python_codes/p03472/s060278001.py
s060278001.py
py
757
python
en
code
0
github-code
90
44824284816
import cv2 import pytesseract pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' cap =cv2.VideoCapture(0) while True: cap.set(10,160) ret,img = cap.read() img = cv2.resize(img,(480,360)) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) out = pytesseract.image_...
akhilreddyar/OCR
ocr.py
ocr.py
py
1,041
python
en
code
0
github-code
90
3704059890
#upload_model.py #this isn't working right now as need a container to run tensorflow #so just manually copying model by hand import os import boto3 import tensorflow as tf downloaded_model='/w251-project/inference/small_model' model=tf.keras.models.load_model(downloaded_model) model_dir='/tmp/inference_model' model...
gregtozzi/deep_learning_celnav
inference/upload_model.py
upload_model.py
py
842
python
en
code
6
github-code
90
18360602899
nf = int(input()) hf = list(map(int, input().split())) h = [hf[0]] for i in range(1, nf): if hf[i] == hf[i - 1]: continue else: h.append(hf[i]) n = len(h) if n == 1: print('Yes') elif n == 2: if h[1] - h[0] >= -1: print('Yes') else: print('No') else: if h[1] - h...
Aasthaengg/IBMdataset
Python_codes/p02953/s243810877.py
s243810877.py
py
778
python
en
code
0
github-code
90
70904666857
def solution(maps): from collections import deque row, col = len(maps), len(maps[0]) visited = [[0 for _ in range(col)] for _ in range(row)] q = deque() q.append((0, 0)) directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] # 상, 하, 좌, 우 while q: ni, nj = q.popleft() visited[ni][...
dohun31/algorithm
2021/week_16/211107/게임맵최단거리.py
게임맵최단거리.py
py
824
python
en
code
1
github-code
90
25136930704
import discord from discord.ext import commands client = commands.Bot(command_prefix="+") @client.event async def on_ready(): print("Bot is ready to go!!") @client.command(name="whois") async def whois(ctx,user:discord.Member=None): if user==None: user=ctx.author rlist = [] for role in user...
mkidcqpw/attendance-information
bot.py
bot.py
py
1,272
python
en
code
1
github-code
90
15748844082
import matplotlib.pyplot as plt import matplotlib.patches as patches import copy import numpy as np class Viewer(): def __init__(self, domain, target='', vlim=(0,0), figsize='default'): self.domain = domain self.target = target if vlim == (0,0): self.adaptative_vlim = True ...
jldez/pyplasma
pyplasma/viewer.py
viewer.py
py
7,205
python
en
code
13
github-code
90
11294559164
from flask import render_template, request, redirect, url_for from flask_login import login_required, current_user from application import app, db from application.threads.models import Thread from application.tags.models import Tag from application.threads.forms import ThreadForm from application.threads.forms import...
Mirex97/Pelifoorumi
application/threads/views.py
views.py
py
5,546
python
en
code
0
github-code
90
25226343542
import model.models as models class Corrector: def select(self): correctors = [] try: select = models.Revisor.select() for corrector in select: data = {"id": corrector.id, "nome": corrector.nome, "instituicao"...
apgifro/prog-kivy
controller/corrector.py
corrector.py
py
3,861
python
pt
code
0
github-code
90
70213327336
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import numpy.lib.stride_tricks as npst import scipy as sp import scipy.signal as spsig from cebl import util from .. import label from .. import optim from .. import paraminit as pinit from .. import stand from ..regression imp...
idfah/cebl
cebl/ml/nnet/convreg.py
convreg.py
py
11,821
python
en
code
10
github-code
90
28012930760
from django.db import models from django.forms import ModelForm from django.contrib.auth.models import User from django import forms class Question_DB(models.Model): professor = models.ForeignKey(User, limit_choices_to={'groups__name': "Professor"}, on_delete=models.CASCADE, null=True) qno = models.AutoField(p...
rishank-shah/Exam-Portal
Exam/questions/question_models.py
question_models.py
py
1,527
python
en
code
48
github-code
90
29542701407
# -*- coding: utf-8 -*- # @Time : 2021/9/30 15:15 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 102. 二叉树的层序遍历.py # @Software: PyCharm # =================================== """给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。   示例: 二叉树:[3,9,20,null,null,15,7], ...
monijuan/leetcode_python
code/AC2_normal/102. 二叉树的层序遍历.py
102. 二叉树的层序遍历.py
py
1,996
python
en
code
0
github-code
90
14685401001
# -*- coding: utf-8 -*- """ TNM patient similarity """ import os import re import time import json import numpy as np import pandas as pd import plotly.express as px import dash_bootstrap_components as dbc from dash import dcc from dash import html from dash.dependencies import Input from dash.depe...
MaastrichtU-CDS/healthai-dashboard
pages/similarity.py
similarity.py
py
7,284
python
en
code
1
github-code
90
15863475816
''' Created on Mar 7, 2020 @author: ballance ''' import os from tsr.messaging import verbose_note class MkfilesDirLoader(object): def __init__(self, dir): self.dir = dir self.engines = [] self.tools = [] def load(self): if not os.path.isdir(self.dir): ...
fvutils/testsuite-runner
src/tsr/mkfiles_dir_loader.py
mkfiles_dir_loader.py
py
1,128
python
en
code
1
github-code
90
11264832045
# -*- coding: utf-8 -*- """ Created on =2019-11-07 @author: wenshijie """ # 电话号码的字母组合 class Solution: def letterCombinations(self, digits: str) -> list: dict_ = dict(zip('23456789', map(list, ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']))) n = len(digits) if n == 0: ...
wenshijie/LeetCode
17/17.py
17.py
py
685
python
en
code
0
github-code
90
23378472408
from copy import deepcopy input = open("input.txt", "r").read().splitlines() for i, j in enumerate(input): input[i] = [int(k) for k in j.strip().split()] def part1(): inpt = deepcopy(input) valid = 0 for i in inpt: i.sort() if int(i[0]) + int(i[1]) > int(i[2]): valid += 1 ...
Yachim/Advent-of-Code
src/AoC2016/day03/day03.py
day03.py
py
625
python
en
code
0
github-code
90
40317531530
import visa import time import csv import os import datetime def gitt(mode): """Galvanostatic Intermittent Titration Technique. :param mode: Specifies mode of operation; must be either charge or discharge. :return voltage: Most recent voltage level.""" if mode == 'discharge':...
bessman/pyvisa-scripts
gitt.py
gitt.py
py
5,089
python
en
code
0
github-code
90
73822573417
# -*- coding: utf-8 -*- import os,subprocess import flask import requests from flask import request,render_template,send_file,jsonify import json import sql from flask_cors import CORS import google.oauth2.credentials import google_auth_oauthlib.flow from google_auth_oauthlib.flow import InstalledAppFlow import googl...
hellof20/Pangu
main.py
main.py
py
11,618
python
en
code
1
github-code
90
18020444329
N, M = map(int, input().split()) A = [ input() for i in range(N)] B = [ input() for i in range(M)] def serch(x0, y0): for i in range(M): for j in range(M): if x0+i >= N or y0+j >= N: return False if A[x0+i][y0+j] != B[i][j]: return False return True if M > N: print('No') exit...
Aasthaengg/IBMdataset
Python_codes/p03804/s868565691.py
s868565691.py
py
457
python
en
code
0
github-code
90
15446036319
#!/usr/bin/python # -*- coding: utf-8 -*- import logging import datetimes import mongo def get_collection(): return mongo.get_collection('users') def get_user(username): with get_collection() as collection: return collection.find_one({'_id':username}) or {} def save_user(username, hashed_pas...
pblin/soshio
admin/data/users.py
users.py
py
2,753
python
en
code
0
github-code
90
18005202789
N = int(input()) A = list(map(int,input().split())) counter = 1 ###グループ数 sign = 0 ###増減、-1,0,1、0はグループの初回、または初回以降増減が見られないときのみ for x in range (1,N): if A[x]>A[x-1] and (sign==0 or sign==1): sign = 1 elif A[x]>A[x-1] and (sign==-1): counter += 1 sign = 0 elif A[x]<A[x-1] and (sign==0 or sign==-1): sign = -1 el...
Aasthaengg/IBMdataset
Python_codes/p03745/s988244550.py
s988244550.py
py
464
python
en
code
0
github-code
90
73330784295
import firebase_admin from firebase_admin import credentials,db,storage import os from tkinter import * cred = credentials.Certificate("serviceAccountKey.json") firebase_admin.initialize_app(cred,options={ 'databaseURL':"https://aqueous-heading-316416-default-rtdb.firebaseio.com/", # for realtime database 'st...
kunj-gandhi889/Student-Attendance-Using-Face-recognition
addData.py
addData.py
py
1,987
python
en
code
0
github-code
90
9381078776
# vim: tabstop=4 shiftwidth=4 softtabstop=4 import nose.exc from keystone import config from keystone import test import default_fixtures CONF = config.CONF OPENSTACK_REPO = 'https://review.openstack.org/p/openstack' KEYSTONECLIENT_REPO = '%s/python-keystoneclient.git' % OPENSTACK_REPO class CompatTestCase(test.Te...
termie/keystonelight
tests/test_keystoneclient.py
test_keystoneclient.py
py
19,290
python
en
code
13
github-code
90
74872355816
import pandas as pd class PandasCsv(): def __init__(self,path): self.path = path self.mydatafile = pd.read_csv(path) def saveCsv(self,nama,nim,jurusan): tambahsiswa = { 'Nim':nim, 'Nama':nama, 'Jurusan':jurusan, '1':'-', '2':'-', '3':'-', '4':'-', '5':'-', '6':'-', '7':'-',...
AhasEkoSeptianto/aplikasi-absensi-mahasiswa
script/PandasFile.py
PandasFile.py
py
1,316
python
id
code
0
github-code
90
30636183790
from collections import deque def dfs(start): search_queue = [] visited = [] search_queue.append(start) while search_queue: node = search_queue.pop() if node not in visited: search_queue += node.get_linked_nodes() visited.append(node) visited.remove(star...
nurlybek-dev/visual-graph
src/network.py
network.py
py
1,626
python
en
code
0
github-code
90
32729687125
class Solution: count = 0 def numberOfSteps(self, num: int) -> int: if num == 0: return(self.count) elif num % 2 == 0: num /= 2 self.count += 1 elif num % 2 != 0: num -= 1 self.count += 1 return self.numberOfSteps(num) ...
DylanDrechsel/code-every-day
coding-challenges/number-of-steps-to-reduce-a-number-to-zero.py
number-of-steps-to-reduce-a-number-to-zero.py
py
354
python
en
code
0
github-code
90
18480246029
import sys import collections sys.setrecursionlimit(10 ** 8) def Z(): return int(input()) def ZZ(): return [int(_) for _ in input().split()] def main(): N, M = ZZ() a = collections.defaultdict(list) id = [''] * (M+1) for i in range(M): p, y = ZZ() a[p].append([y, i+1]) for key in a...
Aasthaengg/IBMdataset
Python_codes/p03221/s514834904.py
s514834904.py
py
570
python
en
code
0
github-code
90
74827367656
from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from api_titles.models import Title from api_users.models import CustomUser class Review(models.Model): author = models.ForeignKey( CustomUser, on_delete=models.CASCADE, related_name='revi...
yurlovaviktoriya/yamdb_final
api_reviews/models.py
models.py
py
1,852
python
en
code
0
github-code
90
18522758789
n = int(input()) L = list(map(int,input().split())) ans = 0 for i in range(n): cnt = 0 while True: if L[i]%2 == 0: cnt +=1 L[i]//=2 else: break ans +=cnt print(ans)
Aasthaengg/IBMdataset
Python_codes/p03325/s170074485.py
s170074485.py
py
229
python
en
code
0
github-code
90
31144082684
#!C:\Users\Lenovo\AppData\Local\Programs\Python\Python37-32\python.exe import pandas as pd from sklearn.linear_model import LogisticRegression import numpy as np data = pd.read_csv("train_u6lujuX_CVtuZ9i.csv") data['Education'] = data['Education'].replace(['Graduate', 'Not Graduate'] , [1.0 , 0.0]) mode_value = data...
RishirajSutar/Loan_Approval_Prediction
pyth.py
pyth.py
py
2,962
python
en
code
0
github-code
90
5418421016
S=0 # Define a function to calculate factorial def f(n): if n==1: return 1 else: return n*f(n-1) #Convert an integer to list with each item integer L=list(str(328)) print(L) for index, item in enumerate(L): L[index] = int(item) print(L) #Calculate the sum of factorials of each bit Length_Cou...
Code-Law/Ex
O.py
O.py
py
443
python
en
code
0
github-code
90
3063500796
# -*- coding: utf-8 -*- """ Created on Mon May 17 12:22:46 2021 @author: aishw """ import numpy as np from time import time import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import pycuda.autoinit from pycuda import gpuarray from pycuda.elementwise import ElementwiseKernel f...
aishwaryamallampati/PennState-MS
GPU Programming/mandelbrot_gpu.py
mandelbrot_gpu.py
py
2,411
python
en
code
0
github-code
90
35900774640
import numpy as np import modules.pd as pd import sys import time import scipy.io from matplotlib import pyplot as plt dx = 0.0001 bbox = [[-.025, .025], [-.025 - 3*dx, .025 + 3*dx], [0,dx]] E = 192e9 nu = 1/3 rho = 8000 NX = int((bbox[0][1]-bbox[0][0])/dx) hrad = 3.015 ntau = 1000 vel = 50 ecrit = .04472 mat = pd.PD...
TransformativeRoboticsLab/peridynamics
bond_based/crack.py
crack.py
py
1,007
python
en
code
1
github-code
90
27474699500
#gcd = GreatestCommonDivisor a = int(input("Enter first integer: ")) b = int(input("Enter second integer: ")) if a == 0 and b == 0: print("Do not exsist divisor") elif a!=0 and b == 0: print('The greatest common divison for',a,'and',b,'is',abs(a)) elif a==0 and b != 0: print('The greatest common divion for',a,'a...
bangoc123/PythonCore
whileLoop/Ex1.py
Ex1.py
py
529
python
en
code
0
github-code
90
16785201623
from django.shortcuts import render, redirect from django.http import HttpResponse from polls.models import Question, Answer, Poll def all_polls_list(request): all_polls_list = Poll.objects.all() context = { 'all_polls_list':all_polls_list } return render(request, 'polls/all_polls_list.html...
codelooper75/UserInterviewAPI
polls/views.py
views.py
py
2,302
python
en
code
0
github-code
90
36271470097
import typing as t from concurrent.futures import Executor from functools import lru_cache from PIL import ImageQt, Image from promise import Promise from PyQt5.QtGui import QPixmap from mtgorp.models.persistent.printing import Printing from mtgimg.load import Loader from mtgimg.interface import ImageRequest, pictu...
guldfisk/mtgqt
mtgqt/pixmapload/pixmaploader.py
pixmaploader.py
py
2,849
python
en
code
0
github-code
90
2878170624
# -*- encoding: utf-8 -*- ''' @File : 107. 二叉树的层次遍历 II.py @Time : 2020/04/27 14:56:21 @Author : windmzx @Version : 1.0 @Desc : For leetcode template ''' # here put the import lib from typing import List # Definition for a binary tree node. import copy import queue class TreeNode: def __init_...
windmzx/pyleetcode
107. 二叉树的层次遍历 II.py
107. 二叉树的层次遍历 II.py
py
1,307
python
en
code
0
github-code
90
9998331709
import requests import json url = "https://test-mobile-configuration-files.s3.eu-central-1.amazonaws.com/stories-test/shelf.json" resp = requests.get(url) print(resp.status_code) jresp = resp.json()['_embedded'] count = 0 ti = [] for i in jresp.values(): for j in i: x = isinstance(j['conte...
rajmenonr/practice
test_ren.py
test_ren.py
py
548
python
en
code
0
github-code
90
14571369371
import tensorflow as tf import numpy as np import os from tensorflow.keras.utils import to_categorical from tensorflow.keras.datasets import mnist def load_mnist(): path = os.path.join(os.getcwd(), 'mnist.npz') (train_data, train_labels), (test_data, test_labels) = mnist.load_data(path) # [batch_size, hei...
choihocheol/machine_learning_study
study_lab_06.py
study_lab_06.py
py
4,211
python
en
code
0
github-code
90
37151697430
import sys # 22.07.15 # https://www.acmicpc.net/board/view/20672 # 반례 # 1 # abcd*cdef # abcdef # 글자 중복해서 세면 안된다. sys.stdin = open("input.txt") n = int(input()) valid = input() split_arr: list = valid.split("*") v1: str = split_arr[0] v2: str = split_arr[1] for _ in range(n): s = input() if len(s) < len(v...
camel-man-ims/coding-test-python
백준/한국이-그리울땐-서버에-접속하지/BJ9996.py
BJ9996.py
py
616
python
en
code
0
github-code
90
34009242033
import tkinter as tk import matplotlib as mpl mpl.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from mpl_toolkits.mplot3d import axes3d, Axes3D import matplotlib.pyplot as plt import numpy as np from CNCController import CNCController class Scene(tk.Frame): CNC_TABLE_...
jessymathault/CNC_UI
Scene.py
Scene.py
py
4,554
python
en
code
1
github-code
90
17989374829
s = input() bool = True for i in range(len(s) - 1): for j in range(i + 1,len(s)): if s[i] == s[j]: bool = False if bool: print('yes') else: print('no')
Aasthaengg/IBMdataset
Python_codes/p03698/s398520290.py
s398520290.py
py
183
python
en
code
0
github-code
90
7527771146
from django.urls import path,include from . import views from .mensagem_service import MensagemViewSet urlpatterns = [ path('enviarMensagem/<id>', views.enviarMensagem, name='enviarMensagem'), path('responderMensagem/<int:idRemetente>/<int:idDestinatario>', views.responderMensagem, name='responderMensagem'), ...
CimaraOliveira/projetoWorkBook
mensagem/urls.py
urls.py
py
587
python
pt
code
0
github-code
90
36191020336
from unicodedata import name from django.urls import path from django.views import View from blog.models import Parfume from .views import (BlogListView, BlogDetailView, BlogCreateView, BlogUpdateView, BlogDeleteView, ...
ibrahimov23/CS50xFinaltask
my_blog/blog_projesi/blog/urls.py
urls.py
py
816
python
en
code
0
github-code
90
18417856859
if __name__ == "__main__": A, B = [int(a) for a in input().split()] cnt = 0 for i in range(2): if A >= B: cnt += A A -= 1 else: cnt += B B -= 1 print(cnt)
Aasthaengg/IBMdataset
Python_codes/p03071/s153060619.py
s153060619.py
py
236
python
en
code
0
github-code
90
33687544860
from bs4 import BeautifulSoup from random import choice from csv import DictReader, DictWriter import requests import os def scrape_quotes(): with open('quotes.csv','a', newline='', encoding='utf-8') as quote_file: headers = ["Quote", "Author", "URL"] writer = DictWriter(quote_file, fieldnames=head...
adace123/Python
quote_guess_game.py
quote_guess_game.py
py
2,606
python
en
code
0
github-code
90
15903981915
######################################################################################################## # The RWKV Language Model - https://github.com/BlinkDL/RWKV-LM ######################################################################################################## import sys import os, math, gc, importlib impor...
neromous/RWKV-Ouroboros
v4/rwkv_model/model_origin.py
model_origin.py
py
25,864
python
en
code
34
github-code
90
34269370347
import routes from twisted.trial import unittest from twisted.internet import defer from txrest import route from txrest.managers.routing import RouteManager, NotFound from txrest.tests.helpers import MockController, MockRequest class Dummy(MockController): full_url = '/v1/api/some/url' @route('/', method=...
dr4ke616/txREST
txrest/tests/test_routes.py
test_routes.py
py
4,301
python
en
code
0
github-code
90
27902648904
import json import os from subprocess import run, Popen, PIPE from .__init__ import executable def train(v_function, num_games, alpha, benchmark_interval=5000): process = Popen( executable + [ "train", f"{num_games}", "-z", "--v_function", ...
maxencefrenette/swipy
scripts/shared/train.py
train.py
py
1,517
python
en
code
1
github-code
90
31422871593
#! usr/bin/env/python3 # coding:utf-8 # @Time: 2018-11-08 13:04 # Author: turpure import os import datetime from src.services.base_service import CommonService class DevRateFetcher(CommonService): """ fetch suffix profit from erp day by day """ def __init__(self): super().__init__() ...
yourant/ur_cleaner
src/tasks/fetch_dev_rate.py
fetch_dev_rate.py
py
3,187
python
en
code
0
github-code
90
10425234629
import pika credentials = pika.PlainCredentials('oeasy', 'oeasy') connection = pika.BlockingConnection(pika.ConnectionParameters('192.168.133.128', 5672, 'myhost', credentials)) channel = connection.channel() #定义交换机,设置类型为direct channel.exchange_declare(exchange='message', exchange_type='direct') #定义三个路由键 routings =...
anstones/py-collection
RabbitMQ/rabbitmq1/send-routing_key.py
send-routing_key.py
py
679
python
en
code
3
github-code
90
70168504616
# Datasets management and partitioning. #!/usr/bin/env python import pathlib import torch import sys from random import Random from torchvision import datasets, transforms # sharing_strategy = "file_descriptor" #file_system # torch.multiprocessing.set_sharing_strategy(sharing_strategy) # def set_worker_sharing_str...
hamidralmasi/FlagAggregator
garfieldpp/datasets.py
datasets.py
py
10,578
python
en
code
0
github-code
90
73501456617
testcase = [] testcase.append((5, [[1, 0, 0, 1], [1, 1, 1, 1], [2, 1, 0, 1], [2, 2, 1, 1], [5, 0, 0, 1], [5, 1, 0, 1], [4, 2, 1, 1], [3, 2, 1, 1]])) testcase.append((5, [[0,0,0,1],[2,0,0,1],[4,0,0,1],[0,1,1,1],[1,1,1,1],[2,1,1,1],[3,1,1,1],[2,0,0,0],[1,1,1,0],[2,2,0,1]])) def check(result, x, y) : for x, y, a in res...
Err0rCode7/algorithm
baekjoon/implementation/기둥과보설치.py
기둥과보설치.py
py
1,082
python
en
code
0
github-code
90
18160754729
s = input() t = input() ans = len(s) for i in range(len(s) - len(t) + 1): sub = s[i:i+len(t)] ans = min(ans, len(t) - sum(a == b for a, b in zip(sub, t))) print(ans)
Aasthaengg/IBMdataset
Python_codes/p02571/s607614445.py
s607614445.py
py
176
python
en
code
0
github-code
90
12844510340
"""added_team_member_relation_with_team Revision ID: 608dfb7c57cb Revises: 3ff6176f0f09 Create Date: 2020-01-03 13:45:05.952738 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '608dfb7c57cb' down_revision = '3ff6176f0f09' branch_labels = None depends_on = None ...
akash-cis/PROJECTS
socialai/WebApp-API-develop/migrations/versions/2020-01-03-13-45_608dfb7c57cb_added_team_member_relation_with_team.py
2020-01-03-13-45_608dfb7c57cb_added_team_member_relation_with_team.py
py
828
python
en
code
0
github-code
90
13953678121
from django.shortcuts import render, HttpResponseRedirect, reverse, get_object_or_404, redirect from django.http import HttpResponseForbidden from django.contrib.auth.decorators import login_required from django.contrib import messages from insta_user.models import InstaUser from insta_post.models import FavoriteCar fr...
pokeyjess/Insta-Car
insta_comment/views.py
views.py
py
2,157
python
en
code
0
github-code
90