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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
27701982895 | import math
class Punto:
def mover(self ,x ,y):
self.x = x
self.y = y
def reiniciar(self):
self.mover(0 ,0)
def calcular_distancia(self ,otro_punto):
return math.sqrt(
(self.x - otro_punto.x)**2
+ (self.y - otro_punto.y)**2
)
punto = Punto()
punto.x = 3
print(punto.x)
##### DE momento marca u... | adguez/python | Punto1.py | Punto1.py | py | 382 | python | es | code | 0 | github-code | 90 |
3332409486 | class Solution:
def to_lower_case(self, s: str) -> str:
"""
核心: 利用大小写字符ASCII值相差32的特性转换,主要调用
chr() -- 将ASCII值转换位字符
ord() -- 获取字符的ASCII值
:param s:
:return:
"""
lower_char_lis = []
for char in s:
if ord('A') <= ord(char) <= ord... | pankypan/DataStructureAndAlgo | leetcode/basicDS01_string/leetcode_709_to_lower_case.py | leetcode_709_to_lower_case.py | py | 743 | python | en | code | 4 | github-code | 90 |
23041436928 | # image3R_orbit_enhanced.py [www.MLTechniques.com]
from PIL import Image, ImageDraw # ImageDraw to draw ellipses etc.
import moviepy.video.io.ImageSequenceClip # to produce mp4 video
from moviepy.editor import VideoFileClip # to convert mp4 to gif
import numpy as np
import math
import random
ran... | VincentGranville/Point-Processes | Videos/image3R_orbit_enhanced.py | image3R_orbit_enhanced.py | py | 5,428 | python | en | code | 30 | github-code | 90 |
2592729347 | """Main GISTys script that contains all required parts of the module."""
# Import standard libraries
import json
from pathlib import Path
import typing as t
import requests
class GISTAmbiguityError(Exception):
"""Exception for multiple GIST filename updates."""
def __init__(
self, gist_ids_list: t.... | ThomasAlbin/gistyc | gistyc/gistyc.py | gistyc.py | py | 10,781 | python | en | code | 15 | github-code | 90 |
14189316653 | # 2492. Minimum Score of a Path Between Two Cities
from typing import List
class Solution:
def minScore(self, n: int, roads: List[List[int]]) -> int:
# The graf will be stored in an adjancency list
visited = [0 for i in range(n+1)]
adj_list = {}
min_road_val = {}
# adj_list[i... | Minho16/leetcode | Daily_problems/MAR23/2023-03-22/MinimumScoreOfAPathBetweenTwoCities_Samu.py | MinimumScoreOfAPathBetweenTwoCities_Samu.py | py | 2,796 | python | en | code | 0 | github-code | 90 |
33492899158 | # -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from ..signal import signal_filter, signal_smooth
def eda_phasic(eda_signal, sampling_rate=1000, method="highpass"):
"""Decompose Electrodermal Activity (EDA) into Phasic and Tonic components.
Decompose the Electrodermal Activity (EDA) into two ... | wsonguga/DataDemo | datasim/eda/eda_phasic.py | eda_phasic.py | py | 10,916 | python | en | code | 4 | github-code | 90 |
20987941958 | # Initialize the calendar
from icalendar import Calendar, Event
from datetime import datetime, timedelta
import pytz
import os
cal = Calendar()
cal.add('prodid', '-//My Calendar Product//mxm.dk//')
cal.add('version', '2.0')
# Data to be included in the calendar
# Updated data to be included in the calendar
data = [
... | nilskluewer/Calender | icalender.py | icalender.py | py | 1,538 | python | en | code | 0 | github-code | 90 |
14189537321 |
import pika
import os
import json
class RabbitMq:
def __init__(self):
url = os.environ.get('CLOUDAMQP_URL', 'amqp://guest:guest@localhost:5672')
self.params = pika.URLParameters(url)
self.connection = None
self.channel = None
def connect(self):
self.connection = pika... | WebServices-DotNet/SignalGenerator | rabbitmq/rabbitmq.py | rabbitmq.py | py | 722 | python | en | code | 0 | github-code | 90 |
18323736449 | mod = 998244353
N = int(input())
D = list(map(int,input().split()))
from collections import Counter
if D[0] != 0 or 0 in D[1:]:
print(0)
else:
dc1 = Counter(D[1:])
dc = [0 for i in range(max(D))]
for k,v in dc1.items():
dc[k-1] = v
ans = 1
for i in range(1,len(dc)):
if dc[i] == 0... | Aasthaengg/IBMdataset | Python_codes/p02866/s625558257.py | s625558257.py | py | 415 | python | en | code | 0 | github-code | 90 |
70202283177 | import numpy as np
import time
from MISSION.env_router import make_env_function
from UTIL.colorful import print亮红
N = lambda x: np.array(x)
# Here use a pool of multiprocess workers to control a bundle of environment to sync step
# SuperPool.add_target: in each process, initiate a class object named xxxx,
# exam... | binary-husky/unreal-map | PythonExample/hmp_minimal_modules/UTIL/shm_env.py | shm_env.py | py | 5,764 | python | en | code | 145 | github-code | 90 |
6626236394 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as readme_file:
readme = readme_file.read()
with open('HISTORY.md', encoding='utf-8') as history_file:
history = history_file.read()
install_requires = ... | sintel-dev/SigPro | setup.py | setup.py | py | 2,647 | python | en | code | 7 | github-code | 90 |
18003411249 | import sys
a=input().strip()
b=input().strip()
if a==b:
print("EQUAL")
elif len(a)>len(b):
print("GREATER")
elif len(b)>len(a):
print("LESS")
else: #same len
for i in range(len(a)):
if int(a[i])>int(b[i]):
print("GREATER")
sys.exit()
elif int(a[i])<int(b[i]):
print("LESS")
sys.e... | Aasthaengg/IBMdataset | Python_codes/p03738/s783034318.py | s783034318.py | py | 326 | python | en | code | 0 | github-code | 90 |
23129779060 | Import( 'env', 'libs', 'installdir', )
mylibs = libs + [ 'gtest', 'gmock', 'pthread' ]
myenv = env.Clone()
myenv.Append(CPPPATH='.')
sources = """
cppshouldtest.cpp
should.cpp
shouldbe.cpp
expectations/contains.cpp
expectations/be.cpp
""".split()
output = myenv.Program(
'cppshouldtest',... | obmarg/cppshould | test/SConscript | SConscript | 452 | python | en | code | 0 | github-code | 90 | |
21911704102 | import networkx as nx
from itertools import combinations
def create_graph_from_events(events):
G = nx.Graph()
G.add_nodes_from([(event['Id'], {'color' : None}) for event in events])
comb = combinations(events, 2)
for i in comb:
res0 = set(i[0]['Resources'])
res1 = i[1]['Resources']
... | OttoMP/qaoa-school-timetable | qaoa/util.py | util.py | py | 3,595 | python | en | code | 0 | github-code | 90 |
11002540912 | n = int(input())
first = list(map(int, input().split()))
second = list(map(int, input().split()))
max_ans, min_ans = 0, 0
for x in first: #최대값이 되려면 전부 양수가 되면 됨
if x < 0:
max_ans += -x
else:
max_ans += x
for y in second: #최소값이 되려면 전부 음수가 되면 됨
if y > 0:
min_ans += -y
else:
... | joey0807/CodeStudy | 문제풀기/baekjoon/14665.py | 14665.py | py | 421 | python | ko | code | 0 | github-code | 90 |
73810048295 | from flask import jsonify, request
from db import db
def category_list_get():
return jsonify({'category_List': category_select()})
def category_post():
category_id = category_max_num() + 1
category_receive = request.form['category_name']
if category_duple_check(category_receive):
return "d... | kil6176/hanghae99 | category.py | category.py | py | 2,019 | python | en | code | 2 | github-code | 90 |
73038589096 | from tkinter import*
root = Tk()
root.geometry("500x500")
root.title("TIC TAC TOE")
frame1=Frame(root)
frame1.pack()
titlelabel1=Label(frame1,text="Tic Tac Toe" , font=30)
titlelabel1.pack()
frame2=Frame(root)
frame2.pack()
board = { 1:" " ,2:" " ,3:" ",
4:" " ,5:" " ,6:" ",
7:" " ,8:" " ,9:" ... | AravindG-4/Tic-Tac-Toe | Tic Tac Toe.py | Tic Tac Toe.py | py | 3,416 | python | en | code | 0 | github-code | 90 |
16162410137 | import numpy as np
from scipy.interpolate import RectBivariateSpline
from scipy.ndimage import affine_transform
import cv2
def disp_img(img, heading):
img = np.array(img)
cv2.imshow(heading, img)
cv2.waitKey()
def InverseCompositionAffine(It, It1, threshold, num_iters):
"""
:param It: template i... | artrela/Computer-Vision-CMU-16720A | HW2/InverseCompositionAffine.py | InverseCompositionAffine.py | py | 4,326 | python | en | code | 1 | github-code | 90 |
34628730285 | # coding=utf-8
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss, MSELoss, L1Loss
from transformers import BertPreTrainedModel, RobertaMode... | HLR/RGN | RGN_model/modeling.py | modeling.py | py | 6,546 | python | en | code | 4 | github-code | 90 |
21673891956 | #!/usr/bin/env python3
import sys
totals = []
current = 0
for line in sys.stdin:
if line.strip():
current += int(line)
else:
totals.append(current)
current = 0
print(sum(sorted(totals)[-3:]))
| pauldraper/advent-of-code-2022 | problems/day-01/part_2.py | part_2.py | py | 225 | python | en | code | 4 | github-code | 90 |
27432224401 | from django.shortcuts import render
#coding=utf-8
# Create your views here.
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import json
from act import exec_cmd,exec_cmd_salt,salt_key,salt_key_accept,salt_key_delete,salt_minion_init,salt_module_name
from rest_framework.decorat... | wjaccck/control | salt_act/views.py | views.py | py | 2,282 | python | en | code | 0 | github-code | 90 |
34424058946 | import random
def print_interface(guessed_word):
print(''.join(guessed_word))
print('Input a letter:', end=' ')
def choose_a_word(words):
random.seed()
return random.choice(words)
def main():
words = ['python', 'java', 'swift', 'javascript'] # words to guess from
print("H A N G M A N\n")
... | Aylon28/Hangman | main.py | main.py | py | 2,166 | python | en | code | 0 | github-code | 90 |
18928125651 | import torch.nn as nn
import logging
from alphabet import Alphabet
from my_utils import random_embedding
import torch
from data import build_pretrain_embedding, my_tokenize, load_data_fda
import numpy as np
import torch.nn.functional as functional
import os
from data_structure import Entity
import norm_utils
from optio... | foxlf823/norm-1-30 | vsm_notrain.py | vsm_notrain.py | py | 7,235 | python | en | code | 2 | github-code | 90 |
18165238959 | n = int(input())
A = list(map(int,input().split()))
ans = 0
t = 0
for e,(i , j) in enumerate(zip(A,A[1:])):
if i + t > j :
ans += t + i-j
t= t + i-j
else:t = 0
# print(t,ans)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02578/s123792116.py | s123792116.py | py | 215 | python | en | code | 0 | github-code | 90 |
35939790399 | import argparse
import os
import pandas as pd
from tqdm import tqdm
import logging
from src.utils.common import read_yaml, create_directories
import random
STAGE = "Get Data Stage-01" ## <<< change stage name
logging.basicConfig(
filename=os.path.join("logs", 'running_logs.log'),
level=logging.INFO,
... | saquibshaikh433/DVC-demo-001 | src/components/stage_load_save.py | stage_load_save.py | py | 1,429 | python | en | code | 0 | github-code | 90 |
31946991121 | import flask
import pandas as pd
import pickle
import sklearn
def chargeTheModel(pretrainedModel,model):
# Use pickle to load in the pre-trained model
print('models/'+pretrainedModel+'_'+model+'.pkl')
with open(f'models/'+pretrainedModel+'_'+model+'.pkl', 'rb') as f:
model = pickle.load(f)
ret... | lilyabeddek/VisualisationDetectionVulnerabilitesCommit | app.py | app.py | py | 3,637 | python | en | code | 0 | github-code | 90 |
31256944407 | def func1(num):
for i in range(2,num):
if num%i==0:
return False
return True
a = int(input())
b = int(input())
sum = 0
min = 10000
for i in range(a,b+1):
if i==1 :
pass
elif i==2:
sum+=2
if min>i:
min =i
else:
if func1(i):
... | sungwoo-me/Algorithm | 백준/기본수학2/2581.py | 2581.py | py | 446 | python | en | code | 0 | github-code | 90 |
72324264616 | import logging
import multiprocessing
import os
import signal
import sys
import time
from dotenv import load_dotenv
from decode import Decode
from record import Record
from source import RtlSdrSource
from transformer.position import Position
from transformer.velocity import Velocity
from transformers import Transform... | lepiaf/adsb-logger | main.py | main.py | py | 2,108 | python | en | code | 1 | github-code | 90 |
28151298901 | import OpenGL.GL as gl
import OpenGL.GLUT as glut
from ._gl import Camera, screenUnProjection, screenUnProjectionDirection, AxisXYZ
from .c_gl import setSomeLighting
def draw_text(x, y, font, text, color):
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glColor3f(... | nobuyuki83/pydelfem2 | PyDelFEM2/gl/glut.py | glut.py | py | 3,530 | python | en | code | 10 | github-code | 90 |
29542365157 | # -*- coding: utf-8 -*-
# @Time : 2021/10/10 22:06
# @Author : 模拟卷
# @Github : https://github.com/monijuan
# @CSDN : https://blog.csdn.net/qq_34451909
# @File : 441. 排列硬币.py
# @Software: PyCharm
# ===================================
"""你总共有 n 枚硬币,并计划将它们按阶梯状排列。对于一个由 k 行组成的阶梯,其第 i 行必须正好有 i 枚硬币。阶梯的最后一行 可能 是不完整... | monijuan/leetcode_python | code/AC1_easy/441. 排列硬币.py | 441. 排列硬币.py | py | 1,807 | python | zh | code | 0 | github-code | 90 |
70839310696 | import time
from sklearn.preprocessing import MinMaxScaler
import helpers
import numpy as np
from sklearn.cluster import SpectralClustering, KMeans
from sklearn.manifold import SpectralEmbedding, Isomap, LocallyLinearEmbedding, TSNE
from sklearn import metrics
from definitions import SAVE_PRED_RESULTS, PLOTTING_MODE
... | Adamantios/Clustering | test.py | test.py | py | 7,679 | python | en | code | 0 | github-code | 90 |
12221517175 | from PySide2.QtWidgets import *
from PySide2.QtGui import *
class PlaybackButton(QPushButton):
def __init__(self, name_icon, parent=None):
super(PlaybackButton, self).__init__(parent)
self._name_icon = name_icon
self._icon = QIcon()
self._function = None
self.initialize()... | gcorpus/MotionScanner | src/MotionScanner/Controller/playback_button.py | playback_button.py | py | 850 | python | en | code | 0 | github-code | 90 |
23816495867 | import urllib.parse
import pytest
from globus_sdk._testing import (
RegisteredResponse,
get_last_request,
load_response,
register_response_set,
)
@pytest.fixture(scope="module", autouse=True)
def _register_stub_transfer_response():
register_response_set(
"cli.api.transfer_stub",
{... | globus/globus-cli | tests/functional/test_api.py | test_api.py | py | 2,635 | python | en | code | 67 | github-code | 90 |
21692880750 | # check the balance of TRX side Exchange_1 or 2. sell-side . priceFtx
# check the balance of USDT side Exchange_1 or 2. buy_side. price2
from ftx.client import Client
import json
import kraken.clientKraken as krak
from pykrakenapi import KrakenAPI
import krakenex
import time
class grand_arbitrage_():
def __init... | memsjava/arb-inter-exchange | main.py | main.py | py | 10,430 | python | en | code | 0 | github-code | 90 |
34787469877 | import threading, queue
import argparse
from application import server_main
from application import client_main
from application import send_main
parser = argparse.ArgumentParser(description='CMPE206 Application')
parser.add_argument('--command', nargs='?', choices=['traceroute', 'ping', 'message'], default='me... | evelynweng/NetworksOverNetworks | mainCMPE206.py | mainCMPE206.py | py | 1,035 | python | en | code | 0 | github-code | 90 |
3721531356 | # -*- coding: utf-8 -*-
def PythagoreanTriplet(N):
a = 0
b = 0
c = 0
for i in range(3, N//3):
a = i
for j in range(i+1, N//2):
b = j
c = N-(a+b)
if(a**2 + b**2 == c**2):
return a,b,c
return 0, 0, 0
a, b, c = PythagoreanTriplet(1... | yiyitao/Project-Euler | 009/problem009.py | problem009.py | py | 353 | python | en | code | 0 | github-code | 90 |
23803387348 | from django import forms
from django.shortcuts import get_object_or_404
from django.db.models import Q
from django.utils.text import slugify
from django.utils.translation import pgettext_lazy
from text_unidecode import unidecode
from saleor.product.models import Collection
from saleor.dashboard.product.forms import R... | 722C/saleor-super-collections | super_collections/dashboard_views/forms.py | forms.py | py | 1,585 | python | en | code | 0 | github-code | 90 |
25918948601 | """
Sorted cmp.h5 column iterator.
Author: Andrey Kislyuk
"""
import sys, logging
import numpy, scipy
from dmtk.io import cmph5
from dmtk.io.cmph5 import CmpH5SortingTools
class ColumnIterator:
""" Supports iteration on alignment columns in reference coordinates.
To identify the reference to iterate over, re... | kislyuk/dmtk | lib/dmtk/io/cmph5/CmpH5ColIterators.py | CmpH5ColIterators.py | py | 20,371 | python | en | code | 2 | github-code | 90 |
11028980843 | import json
import logging
import uuid
from datetime import datetime, timedelta
from uuid import uuid4
import bcrypt
from flask_login import UserMixin
from peewee import JOIN, IntegrityError, fn
from data.database import (
AutoPruneTaskStatus,
DeletedNamespace,
EmailConfirmation,
FederatedLogin,
I... | quay/quay | data/model/user.py | user.py | py | 45,794 | python | en | code | 2,281 | github-code | 90 |
35225670879 | from typing import List, Optional, Tuple, Union, Dict
from functools import lru_cache
from xml.sax.saxutils import escape
import numpy as np
from AnyQt.QtCore import Qt, QPointF, QSize, Signal, QRectF
from AnyQt.QtGui import QColor
from AnyQt.QtWidgets import QApplication, QToolTip, QGraphicsSceneHelpEvent
import py... | biolab/orange3 | Orange/widgets/visualize/owbarplot.py | owbarplot.py | py | 24,764 | python | en | code | 4,360 | github-code | 90 |
22181901074 | """Remove province
Revision ID: 74aa68af5cf9
Revises: 387c46a9e358
Create Date: 2023-04-21 01:01:10.459809
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '74aa68af5cf9'
down_revision = '387c46a9e358'
branch_labels = None
depends_on = None
def upgrade():
... | thabomcodes/INF3014F_Project | migrations/versions/74aa68af5cf9_remove_province.py | 74aa68af5cf9_remove_province.py | py | 807 | python | en | code | 0 | github-code | 90 |
18106260709 | # coding: utf-8
# Here your code !
S = int(input())
N = list(map(int,input().split(" ")))
def seleSort(n,s):
c =0
for i in range(s):
minj = i
for j in range(i+1,s):
if n[j]<n[minj]:
minj = j
n[i],n[minj]=n[minj],n[i]
if i!= minj:
... | Aasthaengg/IBMdataset | Python_codes/p02260/s119685335.py | s119685335.py | py | 416 | python | en | code | 0 | github-code | 90 |
32119374551 | import json
import serial
import pynmea2
import time
serial_handle = serial.Serial('/dev/ttyUSB0',baudrate=4800,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS)
run = True
start_time = 0
while run:
buffer = ''
try:
buffer = serial_handle.readline()
except:
... | CornerstoneLabs/ble-to-sx1272 | read-gps.py | read-gps.py | py | 1,373 | python | en | code | 0 | github-code | 90 |
14391271021 | import asyncio
import time
from datetime import datetime
async def custom_sleep():
print('SLEEP {}\n'.format(datetime.now()))
await asyncio.sleep(5)
async def sum_up_to_num(name, number):
total = 0
for i in range(1, number+1):
total += i
print("Task %s Computing sum of first %d ... | NazimNaeem/python_learn | task15/main.py | main.py | py | 742 | python | en | code | 0 | github-code | 90 |
9092213282 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import theano
import theano.tensor as T
from theano import In, Out
import numpy as np
import timeit
import logging
from scipy import stats
logging.basicConfig(format="[%(asctime)s] %(message)s", ... | splicebox/JULiP | models/model_da.py | model_da.py | py | 11,157 | python | en | code | 3 | github-code | 90 |
18460676279 | def solve():
for i in range(1, n):
if i == 1:
dp[i] = abs(lst[i] - lst[i-1]) + dp[i-1]
else:
dp[i] = min(abs(lst[i] - lst[i-1]) + dp[i-1], abs(lst[i] - lst[i-2]) + dp[i-2])
inf = 1<<60
n = int(input())
lst = list(map(int, input().split()))
dp = [inf] * (n+1)
dp[0] = 0
solve... | Aasthaengg/IBMdataset | Python_codes/p03160/s282256269.py | s282256269.py | py | 339 | python | en | code | 0 | github-code | 90 |
7125645586 | import os
from setuptools import setup
import setuptools
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='UmbrellaReminder',
version='0.0.2',
description=('A Python package which scrapes weather data from google and sends umbrella reminders to specified ... | VinayEdula/UmbrellaReminder | setup.py | setup.py | py | 1,049 | python | en | code | 0 | github-code | 90 |
21671546358 | import sys
import numpy as np
import pandas as pd
import csv
def main():
team_names = create_dict_from_csv("teams.csv")
inputs = get_input_frames("RegularSeasonDetailedResults.csv", team_names)
clean_inputs(inputs)
def create_dict_from_csv(filename):
"""Creates dictionary mapping team ID to team name... | wang19k/PredictingMarchMadness | basketball_parser.py | basketball_parser.py | py | 4,437 | python | en | code | 0 | github-code | 90 |
70946849898 | import open3d as o3d
import numpy as np
import pyvista as pv
import pandas as pd
from io import StringIO
from math import trunc
def convert_xyz_to_array(filename, scale=10):
file_text = open(filename, encoding="cp1251").read().replace(' ', ',')
point_cloud = np.loadtxt(StringIO(file_text), skiprows=1, delimit... | bunsanandme/cad_creator | 3d_reader.py | 3d_reader.py | py | 1,704 | python | en | code | 0 | github-code | 90 |
4962952832 | import os
import sys
import time
import math
import numpy
# import at_cascade with a preference current directory version
current_directory = os.getcwd()
if os.path.isfile( current_directory + '/at_cascade/__init__.py' ) :
sys.path.insert(0, current_directory)
import at_cascade
# BEGIN_PYTHON
#
# csv_file
csv_file =... | bradbell/at_cascade | test/csv_sim_2.py | csv_sim_2.py | py | 3,691 | python | en | code | 3 | github-code | 90 |
18270485209 | N = int(input())
S = [input() for _ in range(N)]
dic = {}
for i in range(N):
if S[i] not in dic.keys():
dic[S[i]] = 1
else:
dic[S[i]] += 1
maxim = max(dic.values())
ans = []
for keys in dic.keys():
if dic[keys] == maxim:
ans.append(keys)
ans.sort()
for i in range(len(ans)):
print(... | Aasthaengg/IBMdataset | Python_codes/p02773/s555562546.py | s555562546.py | py | 328 | python | en | code | 0 | github-code | 90 |
36470573205 |
def main():
problem_one = "5*10"
print(problem_one)
user_input = input()
response_one = ("Correct!")
def new_func():
print(response_one)
if user_input == "50":
new_func()
if user_input != "50":
print("Incorrect, press enter to try again.")
input()... | Cod3-sudo/GPE104 | InputOutputPython.py | InputOutputPython.py | py | 348 | python | en | code | 0 | github-code | 90 |
11604541318 | from apps.clientes.familias.models import *
from apps.clientes.adultos.models import *
from apps.clientes.estudiantes.models import *
from apps.clientes.direcciones.models import *
from apps.contabilidad.precios.models import *
class Cuota:
def calcular_cuota(self,cant_ida_o_vuelta, cant_ida_y_vuelta,descuento):
... | AntonellaLapalma/Escolares.web | apps/clientes/familias/funciones_cliente.py | funciones_cliente.py | py | 10,252 | python | es | code | 0 | github-code | 90 |
27413431905 | #!/usr/bin/python3
#import sys
#from linecache import getline
stringToMatch = '[zeus_creative_recycles]'
matchedLine = []
line_list = []
index_list = []
command = []
myList = []
var = []
var1 = []
#get line
with open('abc.txt', 'r') as file:
# for line in file:
for ind, line in enumerate(file,1):
line_... | chaitusanga/nisum | script2.py | script2.py | py | 1,311 | python | en | code | 0 | github-code | 90 |
20758339626 | from flask import Flask
from flask import render_template, request, flash, g, redirect, url_for
from werkzeug.utils import secure_filename
import json
import os
from flask_bootstrap import Bootstrap
from lib.EventLog import EventLog
global event_log
UPLOAD_FOLDER = r"./upfiles"
ALLOWED_EXTENSIONS = {'gz', 'zip'}
app ... | snakeqx/FlaskEventLogUI | app.py | app.py | py | 3,890 | python | en | code | 0 | github-code | 90 |
40219825265 | '''
Given a list l of characters of length n,
return the probability of permutations of the list
containing the letter 'a' given a permutation
length of integer k.
'''
from itertools import combinations
n = int(input())
l = input().split()
k = int(input())
C = list(combinations(l, k))
f = filter(lambda c: 'a' in c, ... | Algorant/HackerRank | Python/iterables_iterators/iterators.py | iterators.py | py | 367 | python | en | code | 2 | github-code | 90 |
33983181313 | gl_money = 550
gl_water = 400
gl_milk = 540
gl_beans = 120
gl_disposable = 9
def how_many():
print()
print("The coffee machine has:")
print(gl_water, "of water")
print(gl_milk, "of milk")
print(gl_beans, "of coffee beans")
print(gl_disposable, "of disposable cups")
print("$" + str(gl_money... | kabrick/jetbrains-hyperskill-coffee-machine | app.py | app.py | py | 3,314 | python | en | code | 0 | github-code | 90 |
18113469909 | def Is_ToPut(p,w,k):
count =1
temp =p
for i in w:
if temp >= i:
temp -=i
elif i > p :
return 0
else:
count +=1
temp =p-i
if count <= k:return 1
else:return 0
n,k = list(map(int,input().split(' ')))
w =[]
for _ in range(n):... | Aasthaengg/IBMdataset | Python_codes/p02270/s016592645.py | s016592645.py | py | 556 | python | en | code | 0 | github-code | 90 |
7463991249 | age = int(input("Age"))
if age > 13:
student = input("Student? (y/n)")
if student == "y":
print("$8")
elif age >= 18:
print("$12")
else:
print("$9")
elif age >= 5:
print("$7")
else:
print("free")
| standrewscollege2018/2020-year-11-classwork-padams73 | movie_prices1.py | movie_prices1.py | py | 245 | python | en | code | 0 | github-code | 90 |
13738634058 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ############################################################################
#
# op_match_terrain.py
# 04/13/2020 (c) Juan M. Casillas <juanm.casillas@gmail.com>
#
# blender operator to set the track curve and terrain at the same point,
# and move it to the world origin ... | juanmcasillas/RoadTools | roadtools/op_match_terrain.py | op_match_terrain.py | py | 2,282 | python | en | code | 1 | github-code | 90 |
25168635049 | import operator
from datetime import datetime
# Next, we want to sort the clustered files on time, more specifically the starting time followed by end time.
# Location of the clustered taxi source files.
import os
taxi_folder_location = "Z:\\data_engineering\\taxi_clustered_trip_data"
taxi_data_files = [taxi_folder_... | melroy999/2IMW10-Data-Engineering | sort_on_time.py | sort_on_time.py | py | 4,362 | python | en | code | 0 | github-code | 90 |
18012169889 | n, a, b = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans = 0
x = 0
y = 0
for i in range(n):
if i <= a-1:
ans += V[i]
if V[i] == V[a-1]:
... | Aasthaengg/IBMdataset | Python_codes/p03776/s595777914.py | s595777914.py | py | 637 | python | en | code | 0 | github-code | 90 |
27392296570 | def isprime(x):
'''判断一个数是否为素数'''
if x>1:
for i in range(2,int(x**0.5)+1):
if x%i==0:
return True
return False
if __name__=='__main__':
x=int(input('请输入一个数:'))
if isprime(x):
print(x,'为素数',sep='')
else:
print(x,'不是素数',sep='')
| QWQ-ea/python-schoolwork | 1-6章作业/5/7.py | 7.py | py | 339 | python | zh | code | 1 | github-code | 90 |
42138586058 | def main():
set1 = set()
set2 = set()
set3 = set()
# a) Ввод чисел и сохранение их в соответствующих множествах
try:
set1.add(input("Введите строку для первого множества: "))
set2.add(input("Введите строку для второго множества: "))
set3.add(input("Введите строку для третьег... | x1d3/mylabscratedwithpython | laba 7_2.py | laba 7_2.py | py | 3,546 | python | ru | code | 0 | github-code | 90 |
21354938658 | from utils_key import *
def ProductTrans(L0, R0, i):
'''
Arguments:
L0: 第i-1轮输入数据的左半部分
R0: 第i-1轮输入数据的右半部分
i: 轮数
Returns:
Li: 第i轮的输入的左半部分
Ri: 第i轮的输入的右半部分
'''
R1 = Expansion(R0) # 选择扩展运算E
key = GenerateKey(i) # 生成密钥
R2 = xor(R1, key) # 密钥加密运算
R3 = Sbox(R2, S_box) # 选择压缩运算S
R4 = ReplaceFunc(R3, P_box) ... | ujn7843/Crytography_Assignment | 7DES/utils_prodtrans.py | utils_prodtrans.py | py | 574 | python | zh | code | 0 | github-code | 90 |
24282944476 | import cv2
body_class = cv2.CascadeClassifier('haarcascades\haarcascade_fullbody.xml')
cap = cv2.VideoCapture(1)
while(True):
ret, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7,7), 0)
detections = body_class.detectMultiScale(gray)
for (x,y... | jcwong26/COVID-Smart-Elevator | body.py | body.py | py | 575 | python | en | code | 0 | github-code | 90 |
42801883640 | from Layer import Layer
import numpy as np
class Cross_correlation(Layer):
'''
input_shape: 3d_tensor [channels, width, height]
filter_size: 2d_tensor [width_len, height_len]
'''
def __init__(self, input_shape, n_filters, filter_size):
super(Cross_correlation, self).__init__()
asse... | kongjiellx/Frech | Layers/Cross_correlation.py | Cross_correlation.py | py | 2,371 | python | en | code | 0 | github-code | 90 |
22223407775 | from race_score import get_Race_Score
from race_picture import reload_excel,email_attention
import pandas as pd
import time
based_comment_site='http://iranshao.com/races/{}/comments?page={}'
race_id_all=reload_excel.get_RaceID_CommentList()
race_len=len(race_id_all)
for race_id_index1 in range(51,100):
'''初始化最终... | Sososososo12/iranshao_project | race_score/run_getRaceScore_top100.py | run_getRaceScore_top100.py | py | 5,372 | python | en | code | 0 | github-code | 90 |
72070216298 | import pathlib
from datetime import datetime
import psycopg2
import pandas as pd
from airflow import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.python_operator import PythonOperator
#pg_hostname = 'host.docker.internal'
#pg_port = '5425'
#pg_username = 'postgres'
#pg_pass = 'password'
#... | dimamill/Airflow_DE | dags/airflow1t.py | airflow1t.py | py | 2,208 | python | en | code | 0 | github-code | 90 |
35075057695 | hello = '''"just like knowledge, you cant take self-discipline for granted. " \
"unfortunately, being a self-disciplined person isn't a "one and done" kind of thing.
Once you have learned how to live that way, you can still lose it if you don't consistently strengthen it
by setting new challe... | Stanify/Session_pro | cwork.py | cwork.py | py | 2,433 | python | en | code | 0 | github-code | 90 |
13892795264 | import arcade
# Settings for screen
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Better Move Sprite with Keyboard Example"
#Settings for Player
MOVEMENT_SPEED = 5
SPRITE_SCALING = 0.5
player_img = ":resources:images/animated_characters/female_person/femalePerson_idle.png"
# Settings for Bullet
GUN_SOUND = ... | seanrattigan/SW_Arch_OOP | 06_modular/player_move/settings.py | settings.py | py | 459 | python | en | code | 0 | github-code | 90 |
19181504816 | import torch
from tiktoken import Encoding, get_encoding
from os import listdir
from os.path import join
from dotenv import dotenv_values
from typing import Iterator
__all__ = ["load_encoding", "DataLoader"]
def load_encoding() -> Encoding:
_gpt2_encoding = get_encoding("gpt2")
_gpt2_n_vocab = _gpt2_encodin... | pySam1459/EngFr-TranslatorV2 | utils.py | utils.py | py | 2,540 | python | en | code | 0 | github-code | 90 |
14042238144 | import socket
import threading
import sys
import os
import logging
global timeout
class client_Proxy():
def __init__(self, port):
self.host = ''
self.port = port
self.threads = []
self.create_socket()
def create_socket(self):
try:
sock = so... | Yogisai/Proxy-server | proxy.py | proxy.py | py | 11,850 | python | en | code | 0 | github-code | 90 |
29911979222 | # You are given pointer to the root of the binary search tree and two values v1 and v2.
# You need to return the lowest common ancestor(LCA) of v1 and v2 in the binary search tree.
# Function Description
# Complete the function lca in the editor below.
# It should return a pointer to the lowest common ancestor node o... | yuanlang/algorithm-practise | python/bst_lca.py | bst_lca.py | py | 2,459 | python | en | code | 0 | github-code | 90 |
7911095991 | LOGIN_BAD_REQUEST = "Invalid username or password"
GENERIC_BAD_REQUEST = "Invalid request. Please check the request data!"
GENERIC_INTERNAL_ERROR = "Something went wrong please contact system admin!"
GENERIC_FORBIDDEN_ERROR = "You don`t have privilege to perform this action"
GENERIC_RECORD_NOT_FOUND = "Record not found... | avinash-chaluvadi-dev/pratilipi-ana | soa-gateway/app/core/constants.py | constants.py | py | 2,642 | python | en | code | 0 | github-code | 90 |
2098850727 | """
CORE ANONYMOUS FUNCTIONS
- ANON_COUNT
- ANON_SUM
- ANON_AVG
6.6.22
"""
import numpy as np
from scipy.stats import laplace
import matplotlib.pyplot as plt
import pandas as pd
def laplaceMechanism(x, epsilon):
"""Add Laplace noise to query result.
random.laplace parameters:
loc: The position... | chaukap/capstone_team_4 | visualizations.py | visualizations.py | py | 5,264 | python | en | code | 2 | github-code | 90 |
18360855759 | n = int(input())
h = list(map(int, input().split()))
maxx = 0
ans = 1
for i in range(n):
if h[i] - maxx >= -1:
maxx = max(h[i], maxx)
else:
ans = 0
print(["No", "Yes"][ans])
| Aasthaengg/IBMdataset | Python_codes/p02953/s605087244.py | s605087244.py | py | 198 | python | en | code | 0 | github-code | 90 |
21116405596 | """
; Control Plane - K8s Cost Analyzer
; This script belongs to this repository: https://github.com/controlplane-com/k8s-cost-analyzer
; Make sure you meet the prerequisites there before running the script
"""
import os
import re
import sys
import time
import json
import signal
import random
import select
import cer... | controlplane-com/k8s-cost-analyzer | main.py | main.py | py | 51,937 | python | en | code | 27 | github-code | 90 |
32382857355 | import os
import time
import numpy as np
import tvm
from tvm import te, auto_scheduler, topi
@auto_scheduler.register_workload
def gemm(M, N, K, dtype):
A = te.placeholder((M, K), name="A", dtype=dtype)
B = te.placeholder((K, N), name="B", dtype=dtype)
k = te.reduce_axis((0, K), name='k')
... | samuellees/tvm_cooking | operator/gen_gemm_cuda.py | gen_gemm_cuda.py | py | 2,670 | python | en | code | 0 | github-code | 90 |
42195778298 |
import string
import SimplifiedDES
import PlaintextProcessing
import KeyProcessing
import PlainTextInput
def SimpleDESDecrypt(rounds,cipherText,bitKey,S1,S2,reverse_slice):
#region declaration
output=''
binaryxor=''
binaryRight=''
finalDecryptedString=''
dictionary={1:'A',2:'B',3:'C',4:'D',5:'E... | mehab/Encryption | Master/SimpliedDESDecryption.py | SimpliedDESDecryption.py | py | 2,654 | python | en | code | 0 | github-code | 90 |
25933633466 | import requests
from bs4 import BeautifulSoup
URL = "https://web.archive.org/web/20200518073855/https://www.empireonline.com/movies/features/best-movies-2/"
response = requests.get(URL)
response.encoding = "utf-8"
empire_online_page = response.text
soup = BeautifulSoup(empire_online_page, "html.parser")
movies = so... | mbekesithole/top_100_movies_to_watch | main.py | main.py | py | 565 | python | en | code | 0 | github-code | 90 |
8942143407 | import re
## Lookbehind
'''
(?=...)
Matches if ... matches next, but doesn’t consume any of the string.
This is called a lookahead assertion.
'''
lk = re.compile("John(?= Lee)")
print(f"Lookbehind: {lk}")
for sample in [
"John Lee",
"XDD John Lee",
"John XLee",
]:
print(f"{sample: <18}: {lk.searc... | hongtw/coding-life | practice/Python/regex_lookahead.py | regex_lookahead.py | py | 959 | python | en | code | 1 | github-code | 90 |
39199435641 | #!/user/bin/env python
# -*- coding: utf-8 -*-
# @File : view_ml.py
# @Author: sl
# @Date : 2021/9/18 - 下午6:12
"""
探索数据
"""
from pyspark import SparkConf, SparkContext
if __name__ == '__main__':
conf = SparkConf().setAppName("miniProject").setMaster("local[*]")
sc = SparkContext.getOrCreate(conf)
sente... | CycloneBoy/ml-learn | deep/ctr/data/view_ml.py | view_ml.py | py | 858 | python | en | code | 2 | github-code | 90 |
4903232143 | raw = open('raw.txt','r')
x = 1
topics = open('topics.txt','a')
interests = open('interests.txt','a')
for line in raw:
if x % 2 == 1:
topics.write(line)
x = x + 1
print(x)
else:
interests.write(line)
x = x + 1
print(x)
topics.close()
interests.close()
| marshallzhang/harvardlabs | local/data/econ/splittopics.py | splittopics.py | py | 274 | python | en | code | 0 | github-code | 90 |
5100167198 | n=int(input())
a=list(map(int,input().split()))
num=1
start=0
while(start != -1):
try:
start=a.index(num,start)
num+=1
except ValueError:
break
num-=1
#print(n,num)
if(num>0):
print(n-num)
else:
print(-1) | WAT36/procon_work | procon_python/src/atcoder/abc/past/D_148_BrickBreak.py | D_148_BrickBreak.py | py | 244 | python | en | code | 1 | github-code | 90 |
21286545488 | """Window class contains the coordinate for the top left of the game window."""
import ctypes
import platform
import win32gui
from deprecated import deprecated
from typing import Dict, Tuple
class Window:
"""This class contains game window coordinates."""
id = 0
x = 0
y = 0
dc = 0
@depreca... | kujan/NGU-scripts | classes/window.py | window.py | py | 2,514 | python | en | code | 22 | github-code | 90 |
8919574457 | #!/usr/bin/env python
# Script to spawn in objects
import os
import rospy, tf, rospkg
from gazebo_msgs.srv import DeleteModel, SpawnModel
from geometry_msgs.msg import Pose, Point, Quaternion
import random
def run_data_collection():
# init environment with robot and no other objects
for env in environmen... | braxtonj/cs6350_s19_project | code/ws/src/ll4ma_robots_gazebo/scripts/data_collection.py | data_collection.py | py | 2,476 | python | en | code | 0 | github-code | 90 |
30290550992 | import requests
import json
import io
class OctopusClient:
def __init__(self, base_url, api_key):
self.base_url = base_url
self.headers = {'X-Octopus-ApiKey': api_key}
def get_template(self, template_id, name):
if template_id is not None:
return self._ge... | arielrak/Morty | octopus/client/octopus_client.py | octopus_client.py | py | 3,737 | python | en | code | 0 | github-code | 90 |
18507054569 | n = int(input())
xmax, ymax = n//4, n//7
ok = False
for x in range(0, xmax+1):
for y in range(0, ymax+1):
if n == 4*x + 7*y:
ok = True
break
if ok: break
print("Yes" if ok else "No")
| Aasthaengg/IBMdataset | Python_codes/p03285/s773137041.py | s773137041.py | py | 223 | python | en | code | 0 | github-code | 90 |
73611362537 | from subprocess import CalledProcessError, check_output
from charms.layer.apache_bigtop_base import Bigtop
from charms import layer
from charmhelpers.core import hookenv
from jujubigdata import utils
class Pig(object):
"""
This class manages Pig.
"""
def __init__(self):
self.dist_config = uti... | fuslab/anyscale-package | bigtop-packages/src/charm/pig/layer-pig/lib/charms/layer/bigtop_pig.py | bigtop_pig.py | py | 2,350 | python | en | code | 5 | github-code | 90 |
70298868137 | from logging import error
from flask import Flask, request
from flask_restful import Resource, Api, reqparse
import json
app = Flask(__name__)
api = Api(app)
null = None
class inspire(Resource):
def get(self):
f = open("inspire.json","r")
data = json.load(f)
return data
class elements(Re... | lisadw10/uas-backend | UAS/app.py | app.py | py | 1,634 | python | en | code | 0 | github-code | 90 |
28779201393 | import os
import sys
import json
from aiohttp import web
import socketio
import uuid
class lineups:
def __init__(self, logger, bot):
self.logger = logger
self.bot = bot
# initializing environment
sys.path.append('../../common/script')
import initEnv
logger, bot = initEnv.env(__file__).ret()
s... | zxingz/nba | script/webGui.py | webGui.py | py | 1,350 | python | en | code | 0 | github-code | 90 |
32314079359 | class node:
def __init__(self,data):
self.data=data
self.next=None
class linkedlist:
def __init__(self):
self.head= None
self.last_node=None
def insert_sort(self,data):
new_node=node(data)
if self.head is None:
self.head=new_node
elif self.... | shailesh05/data_structures | orderlist.py | orderlist.py | py | 2,831 | python | en | code | 0 | github-code | 90 |
26624594861 | from django import template
register = template.Library()
@register.filter(name='split')
def split(value, arg):
splt_arg, index_split = arg.split(' ')
return value.split(splt_arg)[int(index_split)]
@register.simple_tag
def direktur_auth(rumahsakits, rumahsakits_confirmed):
try: rumahsakit_id =... | ganiyamustafa/PIRUS | core/templatetags/custom_tags.py | custom_tags.py | py | 885 | python | en | code | 1 | github-code | 90 |
70407288297 | from django.shortcuts import render, redirect, reverse, HttpResponse
from django.contrib import messages
from events.models import Events
def view_bag(request):
return render(request, 'bag/bag.html')
def add_to_bag(request, item_id):
event = Events.objects.get(pk=item_id)
quantity = int(request.POST.... | StaffanHynge/E-commerce-store-v1 | bag/views.py | views.py | py | 1,403 | python | en | code | 0 | github-code | 90 |
18359898116 | from collections import deque
from datetime import datetime
from random import randint
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy.optimize import leastsq
import time
from fifo import FifoScheduler
from lane import Lane
from direction import Direction
import tkinter
cl... | jvonhacht/bachelors-thesis | v1/simulator.py | simulator.py | py | 20,272 | python | en | code | 4 | github-code | 90 |
23477456188 | from django.test import TestCase
from wagtail.core.models import Page
from scripts import create_careers_pages
from v1.tests.wagtail_pages.helpers import save_page
class TestCreateCareersPages(TestCase):
def setUp(self):
self.slugs = (
'about-us',
'careers',
'working-... | KonstantinNovizky/Financial-System | python/consumerfinance.gov/cfgov/scripts/tests/test_create_careers_pages.py | test_create_careers_pages.py | py | 1,363 | python | en | code | 1 | github-code | 90 |
25681913943 | import pkg_resources
from PyQt5 import uic, QtCore, QtWidgets
from ... import pipeline
class MatrixPlot(QtWidgets.QWidget):
active_toggled = QtCore.pyqtSignal()
option_action = QtCore.pyqtSignal(str)
modify_clicked = QtCore.pyqtSignal(str)
def __init__(self, identifier=None, state=None):
Qt... | ZELLMECHANIK-DRESDEN/ShapeOut2 | shapeout2/gui/matrix/pm_plot.py | pm_plot.py | py | 2,592 | python | en | code | 7 | github-code | 90 |
11521848101 | import os
import subprocess
from typing import List, Tuple, Union
import torch
import fannypack
def _run_command(command: Union[str, List[str]]) -> Tuple[str, str, int]:
"""Helper for running a command & returning results."""
proc = subprocess.Popen(
command,
stdout=subprocess.PIPE,
... | brentyi/fannypack | tests/scripts/test_buddy_cli.py | test_buddy_cli.py | py | 4,129 | python | en | code | 5 | github-code | 90 |
13003075158 | '''
2
2
1 2
3 4
3
9 3 4
6 1 5
7 8 2
'''
def find(r, c, visit):
for k in range(4):
nr = r + dr[k]
nc = c + dc[k]
if nr < 0 or nr > N-1 or nc < 0 or nc > N-1:
continue
if n[nr][nc] - n[r][c] == 1:
visit += 1
return find(nr, nc, visit)
return vi... | hyeinkim1305/Algorithm | SWEA/D4/SWEA_1861_정사각형방.py | SWEA_1861_정사각형방.py | py | 919 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.