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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38453844732 | import sys
input = sys.stdin.readline
m = int(input())
x = int(1e9)+7
q = 0
for _ in range(m):
n,s = map(int,input().split())
nInv = pow(n,-1,x)
q = (q + (s*nInv)) % x
print(q) | LightPotato99/baekjoon | math/modInverse/sigma.py | sigma.py | py | 190 | python | en | code | 0 | github-code | 6 |
858041514 | from __future__ import division
import copy
from vistrails.db.versions.v1_0_1.domain import DBVistrail, DBWorkflow, DBLog, \
DBRegistry, DBGroup, DBTag, DBAnnotation, DBAction, IdScope
def translateVistrail(_vistrail):
tag_annotations = {}
notes_annotations = {}
thumb_annotations = {}
upgrade_anno... | VisTrails/VisTrails | vistrails/db/versions/v1_0_1/translate/v1_0_2.py | v1_0_2.py | py | 6,533 | python | en | code | 100 | github-code | 6 |
457427877 | # encoding: utf-8
"""
@author: liaoxingyu
@contact: sherlockliao01@gmail.com
"""
import logging
import math
from collections import OrderedDict
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd.variable import Variable
from fastreid.modeling.ops import MetaConv2d, MetaLinear, Meta... | peterzpy/ACL-DGReID | fastreid/modeling/backbones/meta_dynamic_router_resnet.py | meta_dynamic_router_resnet.py | py | 29,474 | python | en | code | 8 | github-code | 6 |
11878648706 | '''
Write a program that takes 3 integers as input and checks whether they can form the sides of a right angled triangle or not. Print YES if they can form a right angled triangle. NO, otherwise.
Input Format:
Single line of input contains three numbers
Output Format:
Print YES or NO
Example:
Input:
5 4 3
Outp... | HrideshSingh/PythonPrograms | RightAngleTriangle.py | RightAngleTriangle.py | py | 501 | python | en | code | 0 | github-code | 6 |
38149030065 | import pygame
from pygame.surface import *
from pygame.sprite import Sprite
from pygame.sprite import RenderUpdates as SpriteGroup
from pygame.sprite import spritecollide
from pygame.sprite import spritecollideany
from pygame.rect import Rect
from random import *
from config import *
from log import *
screen = None
... | mikedll/pybomber2 | desktop/widget.py | widget.py | py | 5,122 | python | en | code | 1 | github-code | 6 |
3778986147 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... | GiovanniStephens/country-rank | docs/source/conf.py | conf.py | py | 1,516 | python | en | code | 0 | github-code | 6 |
11251886844 | import itertools
h, w = map(int, input().split())
map_lst = []
for i in range(h):
map_lst.append(list(input()))
b_lst = [[-1] * w for i in range(h)]
b_lst[0][0] = 0
e_lst = [[0, 0]]
#be_r, be_c:調べる前の座標, r, c:調べる座標
def main(be_r, be_c, r, c, bw, cnt):
# print(r, c)
if b_lst[r][c] != -1:
r... | amaguri0408/AtCoder-python | AGC043/a2.py | a2.py | py | 1,058 | python | en | code | 0 | github-code | 6 |
39634585253 | # supervised training
import argparse
import os
import numpy as np
import math
import itertools
import datetime
import time
import sys
import torchvision.transforms as transforms
import torchvision.models as models
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision impor... | JingshuaiLiu/HFMRI | single_coil_dense_network.py | single_coil_dense_network.py | py | 21,183 | python | en | code | 2 | github-code | 6 |
22779572502 | from collections import deque
vowels = deque(x for x in input().split())
consonants = [x for x in input().split()]
flowers = {
"rose": [],
"tulip": [],
"lotus": [],
"daffodil": []
}
def check_for_a_match():
for word, found in flowers.items():
if len(found) == len(word):
retur... | DanieII/SoftUni-Advanced-2023-01 | advanced/exam_practice/flower_finder.py | flower_finder.py | py | 1,076 | python | en | code | 0 | github-code | 6 |
28395227304 | import torch
import torch.nn as nn
class ContentLoss(nn.Module):
def __init__(self, target):
super(ContentLoss, self).__init__()
# 必须要用detach来分离出target,否则会计算目标值的梯度
self.target = target.detach()
self.criterion = nn.MSELoss()
def forward(self, inputs):
self.loss = self.c... | cwpeng-cn/style-transfer | losses.py | losses.py | py | 1,004 | python | en | code | 0 | github-code | 6 |
22814997152 | # s1 = '1234' when s2 = '1234', '2341', '3412' or '4123', return True, else return False
# 1. s = s1 + s1 ('12341234')
# 2. KMP s with s2
def kmp_get_next(p):
p_len = len(p)
next_arr = [0] * p_len
next_arr[0] = -1
k = -1
i = 0
while i < p_len-1:
if k == -1 or p[k] == p[i]:
... | solaaa/alg_exercise | is_reversecd_word.py | is_reversecd_word.py | py | 905 | python | en | code | 0 | github-code | 6 |
71270411708 | """
This question is asked by Amazon. Given a non-empty linked list,
return the middle node of the list. If the linked list contains
an even number of elements, return the node closer to the end.
Ex: Given the following linked lists...
1->2->3->null, return 2
1->2->3->4->null, return 3
1->null, return 1
"""
class Li... | lucasbivar/coding-interviews | the-daily-byte/week_03/day_18_find_middle_element.py | day_18_find_middle_element.py | py | 1,161 | python | en | code | 0 | github-code | 6 |
38902423747 | import time
import subprocess
import digitalio
import board
from PIL import Image, ImageDraw, ImageFont
import adafruit_rgb_display.st7789 as st7789
import pynmea2
import sys
from subprocess import Popen, PIPE
import serial
import io
# Configuration for CS and DC pins (these are FeatherWing defaults on M0/M4):
cs_pin ... | vwls/toolbox | gps_data_to_screen.py | gps_data_to_screen.py | py | 4,226 | python | en | code | 0 | github-code | 6 |
38290618145 | # Given an array of intervals, find the next interval of each interval.
# In a list of intervals, for an interval ‘i’ its next interval ‘j’ will have
# the smallest ‘start’ greater than or equal to the ‘end’ of ‘i’.
# Write a function to return an array containing indices of the next interval of each input interval.
#... | nanup/DSA | 9. Two Heaps/436. Find Right Interval.py | 436. Find Right Interval.py | py | 1,263 | python | en | code | 0 | github-code | 6 |
4657631542 | import random
import copy
# Чисто параметры для проверки алгоритма
seed_value = 60 # зерно рандомайзера
kolvo_prov = 10 # количество проверок
arr_legth = 20 # длинна проверяемых списков
random.seed(seed_value) # установка зерна
# Сам алгоритм быстрой сортировки.
def quick_sort(array):
if len(array) < 2:
... | WeideR66/littlepythonprojects | quick_sort_alg.py | quick_sort_alg.py | py | 2,022 | python | ru | code | 0 | github-code | 6 |
33415585016 | import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
import scipy.optimize as optimize
# Opening image
img = cv.imread("red.png")
# Uncomment this and run the program to make sure the
# convex_hull_pointing_up algorithm works
# img = cv.rotate(img, cv.ROTATE_180)
# OpenCV stores im... | IamParvSinghal/Wisconsin_Autonomous | CV.py | CV.py | py | 4,280 | python | en | code | 0 | github-code | 6 |
12267302602 | # -*- coding: utf-8 -*-
import scrapy
from collections import OrderedDict
class BriefingEarningsSpider(scrapy.Spider):
name = 'briefing_earnings'
allowed_domains = ['www.briefing.com']
start_urls = ['https://www.briefing.com/Inv/content/Auth/Calendar/Earnings/week1.htm'] # Current week (week1)
def ... | kompotkot/WebScraper-Stocksinplay | stocksinplay/spiders/briefing_earnings.py | briefing_earnings.py | py | 1,854 | python | en | code | 0 | github-code | 6 |
43918724986 | import streamlit as st
import pandas as pd
import plotly.express as px
import seaborn as sns
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
st.set_option('deprecation.showPyplotGlobalUse', False)
# Loading dataset
df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databa... | avrabyt/Holiday-coding-session | streamlit_app.py | streamlit_app.py | py | 1,556 | python | en | code | 3 | github-code | 6 |
27937806135 | #!/usr/bin/python
# coding: utf-8
import numpy as np
import cv2
import csv
import os
import shutil
import shutil
import logging
def to_image_string(image_filepath):
return open(image_filepath, "rb").read().encode("base64")
def from_base64(base64_data):
nparr = np.fromstring(base64_data.decode("base64"), np.... | Zyniel/DansePlanningManager | src/app/utils.py | utils.py | py | 1,569 | python | en | code | 0 | github-code | 6 |
72000458749 | """Tensorflow transformer layers definition in trident"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import math
import tensorflow as tf
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from trid... | AllanYiin/trident | trident/layers/tensorflow_transformers.py | tensorflow_transformers.py | py | 13,672 | python | en | code | 74 | github-code | 6 |
27956151936 | # -*- coding: utf-8 -*-
import os
import pickle
#%%
def read_data_from_1810_09466():
# elements in datalist:
# element[0] = R (kpc)
# element[1] = vc (km/s)
# element[2] = sigma- (km/s)
# element[3] = sigma+ (km/s)
# element[4] = syst (km/s) # saved later
dir_path = os.pa... | pabferde/galaxy_dynamics_from_Vc | src/GalaxyDynamicsFromVc/datahandling.py | datahandling.py | py | 1,894 | python | en | code | 0 | github-code | 6 |
11234447623 | class exc(Exception):
types = {}
types["NV"] = "Not Enough or too many Values. Required at least 2."
types["NB"] = "Non base 2 numbers. . ."
class calculate(exc):
def __init__(self, instance_numbers=[0, 1], output_answer=True):
for items in [(len(instance_numbers) != 2, "NV"), (len([bob for bob in instance_... | noobprogammier/Semiconductor | semiconductor.py | semiconductor.py | py | 933 | python | en | code | 1 | github-code | 6 |
6460491132 | import random
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
nums = []
for i in range(1, 10):
num = random.randint(1, 100)
nums.... | JohelPires/codewars | shellsort.py | shellsort.py | py | 765 | python | en | code | 0 | github-code | 6 |
30610778506 | """
Meta manager. Defines complex workflow in terms of lower level managers
For usage example see tests
"""
import re
from time import time
import logging
from collections import defaultdict, OrderedDict as odict
from copy import copy, deepcopy
import yaml
from shub_workflow.base import WorkFlowManager
from .util... | hermit-crab/shub-workflow | shub_workflow/graph/__init__.py | __init__.py | py | 17,269 | python | en | code | null | github-code | 6 |
29250448134 | from __future__ import annotations
import os
import unittest
from collections import defaultdict, namedtuple
from math import ceil
from typing import Any, Iterator
import numpy as np
from rtree.index import Index, Property, RT_TPRTree
class Cartesian(
namedtuple(
"Cartesian",
("id", "time", "x"... | Toblerity/rtree | tests/test_tpr.py | test_tpr.py | py | 7,681 | python | en | code | 573 | github-code | 6 |
48354201 | from typing import *
import heapq
# TLE
# https://leetcode-cn.com/submissions/detail/292094052/testcase/
class Solution:
def busiestServers(self, k: int, arrival: List[int], load: List[int]) -> List[int]:
result = []
server_load = [0] * k
# 1 is available, 0 is busy
available... | code-cp/leetcode | solutions/1606/main.py | main.py | py | 2,144 | python | en | code | 0 | github-code | 6 |
22354810782 | from tkinter import ttk
import bitmap
from tkinter import Tk, mainloop, Canvas, PhotoImage, filedialog
def rgb2hex(r, g, b):
"""
Convert an r,g,b colour to a hex code
"""
return "#{:02x}{:02x}{:02x}".format(r, g, b)
class Root(Tk):
"""
This is the root object, which inherits from TK
The... | SinaKhalili/bmp-compressor | main.py | main.py | py | 2,646 | python | en | code | 0 | github-code | 6 |
4886937902 | import numpy as np
import torch
def ious(box, boxes, isMin = False):#定义iou函数
box_area = (box[3] - box[1]) * (box[4] - box[2])#计算自信度最大框的面积
area = (boxes[:, 3] - boxes[:, 1]) * (boxes[:, 4] - boxes[:, 2])#计算其他所有框的面积
xx1 = torch.max(box[1], boxes[:, 1])#计算交集左上角x的坐标其他同理
yy1 = torch.max(box[2], box... | RockingHorse-L/yolov3 | YOLOV3/tool1.py | tool1.py | py | 2,668 | python | zh | code | 2 | github-code | 6 |
37197760033 | from datetime import datetime
class Greeter:
def __init__(self, name):
self.name = name
def day():
return datetime.now().strftime('%A')
def part_of_day(): # Определяет часть, дня основываясь на текущем часе
current_hour = datetime.now().hour
if current_hour < 12:
... | alecksandr-slavin/git_work | stepick_v1/new.py | new.py | py | 980 | python | ru | code | 0 | github-code | 6 |
650322467 | #! /bin/python
import os
import sys
import json
from concurrent import futures
import numpy as np
import vigra
import luigi
import z5py
import nifty
import nifty.tools as nt
import nifty.distributed as ndist
from elf.segmentation.lifted_multicut import get_lifted_multicut_solver
from elf.segmentation.multicut import ... | constantinpape/cluster_tools | cluster_tools/lifted_multicut/solve_lifted_subproblems.py | solve_lifted_subproblems.py | py | 13,622 | python | en | code | 32 | github-code | 6 |
70063403388 | from multiprocessing import context
from pwn import *
from LibcSearcher import *
context.log_level = 'debug'
# p=process('./pwn')
p=remote('t.ctf.qwq.cc',49468)
pause()
elf=ELF('./pwn')
context.arch ='amd64'
context.bits=64
shellcode=asm('push 0x68;mov rax ,0x68732f6e69622f;push rax;mov rdi,rsp;xor rsi, rsi;xor rd... | CookedMelon/mypwn | NPU/shellcode/exp.py | exp.py | py | 520 | python | en | code | 3 | github-code | 6 |
69893012668 | import episodes
import praw
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
comments_dict = {
'comment_id': [],
'comment' : [],
'Upvotes_Comment' : [],
'author' : []
}
reddit = episodes.reddit
submission = reddit.submission(id=episodes.episodes[-2])
submission... | mabolhal/rpdrSeason12 | rpdr_main.py | rpdr_main.py | py | 2,025 | python | en | code | 0 | github-code | 6 |
21480391270 | from collections import namedtuple, defaultdict
import numpy as np
import bmesh
import bpy
from ..math import get_dist_sq
from ..log import log, logd
from ..helpers import get_context, get_modifier_mask
# shape_key_apply_modifiers TODO:
# - Specialcase more merging modifiers, solidify for example
# - Trans... | greisane/gret | mesh/shape_key_apply_modifiers.py | shape_key_apply_modifiers.py | py | 15,203 | python | en | code | 298 | github-code | 6 |
33550488518 | from tkinter import *
from tkinter.messagebox import showinfo, showerror
import random
cards = {"shown": random.randint(1, 13), "secret": random.randint(1, 13)}
window = Tk()
window.title("High-Low Card Game")
window.geometry("300x100")
Label(window, text="The shown card is, ").grid(row=0, column=0)
shown_card_labe... | gabrielecalvo/Language4Water | archive/2021-22_semester2/bespoke_samples/desktop_gui/tkinter/1_high_low.py | 1_high_low.py | py | 1,414 | python | en | code | 4 | github-code | 6 |
22751373229 | '''
Created on Apr 29, 2014
@author: oliwa
'''
class DataHolderForDirectOutput(object):
'''
Holds the direct results data from the NMAUnified that is to be outputted.
'''
def __init__(self, protein1_A_name):
'''
Constructor
Args:
protein1_A_name: the name of the ... | Shen-Lab/cNMA | Software/DataHolderForDirectOutput.py | DataHolderForDirectOutput.py | py | 2,230 | python | en | code | 4 | github-code | 6 |
35951119766 | class hamming():
def dystans(self,a, b):
if type(a) != str or type(b) != str:
raise ValueError("a lub b nie jest str")
if len(a) != len(b):
raise ValueError("dlugosc a nie rowna dlugosci b")
wynik = 0
for i in range(len(b)):
if a[i] != b[i]:
... | TestowanieAutomatyczneUG/laboratorium-13-matt1sor | zad2/src/hamming.py | hamming.py | py | 361 | python | pl | code | 0 | github-code | 6 |
26053687100 | from itertools import permutations
vowels = ["а"]
consonants = ["б", "т", "с"]
result = set()
for index, i in enumerate(permutations("аббатиса")):
correct = True
for symbol_index in range(0, len(i) - 1):
if (i[symbol_index] in vowels and i[symbol_index + 1] in vowels) or \
(i[symbol_in... | Woolfer0097/UGE_IT | 8 task/235.py | 235.py | py | 495 | python | en | code | 0 | github-code | 6 |
41058579846 | class Poly:
def __init__(self,*terms):
# __str__ uses the name self.terms for the dictionary of terms
# So __init__ should build this dictionary from terms
self.terms = {}
if terms:
for term in terms:
power = term[1]
coeff = t... | solomc1/python | ics 33/solutions/ile2 solutions/Lab 5/LiTina/poly.py | poly.py | py | 5,891 | python | en | code | 0 | github-code | 6 |
9485038359 | #!/usr/bin/env python3
# import ROS for developing the node
import rospy
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
# for reading the force commands
force = 0.0
pos_cur = float()
key_released = True # by default we assume that they arrow key on keyboard is not pressed
# get the force value... | hsaeidi-uncw/robot_filtering_lectures | scripts/turtle_inertia.py | turtle_inertia.py | py | 2,203 | python | en | code | 0 | github-code | 6 |
74658796346 | import sys
import turtle
import numpy as np
import random
from . import lsystem
def deviate(value, dev):
return value * (2 ** np.random.normal(dev[0], dev[1])) + dev[2] + random.uniform(-dev[3], +dev[3])
#def draw_leaf(t):
def turtle_interprate(symbols, distance=5, angle=45, init_pos=(0,0), speed=0, pen_color='whit... | valentinlageard/lindertree | lindertree/turtle_interprate.py | turtle_interprate.py | py | 2,087 | python | en | code | 1 | github-code | 6 |
17430789952 | #!/usr/bin/python
# https://www.udemy.com/course/complete-python-developer-zero-to-mastery/
# 246. Hacker News Project
# https://www.synerzip.com/blog/web-scraping-introduction-applications-and-best-practices/
# https://www.crummy.com/software/BeautifulSoup/
# https://www.crummy.com/software/BeautifulSoup/bs4/doc/
#... | olexandrch/UdemyCompletePythonDeveloper | Sec.18 246 Hacker News Project.py | Sec.18 246 Hacker News Project.py | py | 1,683 | python | en | code | 0 | github-code | 6 |
37431499468 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
name: Dlink DIAGNOSTIC.PHP命令执行
referer: https://www.exploit-db.com/exploits/24956
author: Lucifer
description: Some D-Link Routers are vulnerable to OS Command injection in the web interface.
On DIR-645 versions prior 1.03 authentication isn't needed to exploit it. On ... | iceyhexman/onlinetools | scanner/plugins/hardware/router/router_dlink_command_exec.py | router_dlink_command_exec.py | py | 2,122 | python | en | code | 1,626 | github-code | 6 |
3200652220 | import rodMassParam as P
import loopshape_rodMass as L
import numpy as np
class controllerLoop:
def __init__(self):
self.A_C = L.Css.A
self.B_C = L.Css.B
self.C_C = L.Css.C
self.D_C = L.Css.D
self.A_F = L.Fss.A
self.B_F = L.Fss.B
self.C_F = L.Fss.C
se... | mebach/me431 | homework_template_folders/homework_template_folders/practice_final/python/controllerLoop.py | controllerLoop.py | py | 1,736 | python | en | code | 0 | github-code | 6 |
42095434916 | from selenium import webdriver # driver de selenium
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium_stealth import stealth # Ayuda a evitar que las webs nos detecten que somos un bot
from shutil import which
def iniciar_webdriver(headless=True):... | Jonnathan1093/Telegram-Chatbot | ChatHeroku/iniciar_Webdriver.py | iniciar_Webdriver.py | py | 1,666 | python | es | code | 0 | github-code | 6 |
15200494736 | #!/usr/bin/env python
from numpy import array
from math import sqrt
from pyspark import SparkContext
# from pyspark.mllib.clustering import KMeans, KMeansModel
from pyspark.mllib.clustering import KMeans
sc = SparkContext(appName="Kmeans Pyspark")
# Load and parse the data
data = sc.textFile("hdfs://localhost:9000/... | sindongboy/topinion | python/lda.py | lda.py | py | 1,071 | python | en | code | 0 | github-code | 6 |
21433461529 | import csv
import logging
import os
logger = logging.getLogger("app_logger")
# Channels with extra long videos messing up the stats and to be deleted,
# or other channels you just don't want to include.
CHANNELS_NOT_TO_IMPORT = ["4k SCREENSAVERS", "Nature Relaxation Films", "4K Relaxation Channel"]
# Some extra lo... | arilaakso/viewinginsights | import_data_into_db.py | import_data_into_db.py | py | 4,855 | python | en | code | 0 | github-code | 6 |
20519700810 | """!
@brief Cluster analysis algorithm: X-Means
@details Implementation based on papers @cite article::xmeans::1, @cite article::xmeans::mndl
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import copy
import numpy
from enum import IntEnum
from math imp... | annoviko/pyclustering | pyclustering/cluster/xmeans.py | xmeans.py | py | 28,247 | python | en | code | 1,113 | github-code | 6 |
41675770750 | # 미로만들기
import sys
import heapq
input = sys.stdin.readline
N = int(input())
# 미로 생성
maze = [list(map(int, list(input().rstrip()))) for _ in range(N)]
# 미로를 탐색할 큐를 생성
queue = [[0, 0, 0]]
# 방문처리할 리스트 NxN
visited = [[False for _ in range(N)] for _ in range(N)]
# 상하좌우 4방향
direction = [(1, 0), (0, -1), (-1, 0), (0, 1)... | jisupark123/Python-Coding-Test | 알쓰/week3/2665.py | 2665.py | py | 1,049 | python | ko | code | 1 | github-code | 6 |
33353045212 | from django.contrib.auth.models import User
from django.db import models
# Create your models here.
from django.db.models.signals import pre_delete
from django.dispatch import receiver
class CommonInfo(models.Model):
# 开始时间 auto_now_add=True,
startday = models.DateField(verbose_name="下单时间", null=True)
# ... | willmaker2022/drfvueblog | productplan/models.py | models.py | py | 6,808 | python | en | code | 0 | github-code | 6 |
26846946693 | n = ['casa','branco','verde']
for ordem,lista in enumerate(n): #
print(f'{ordem+1}° {lista}' ,end=(' '))
print()
lanche = ["X,Salada","Hot Dog","Misto Quente","Coca Cola","Pastel",]
lanche.append("Bacon") #Adcionar
lanche.sort() #Organizar (ordem alfabética)
lanche.sort(reverse=True) #Organiza Inverso
lanche.insert... | davileal7/curso-python | curso em video/17 Listas 1.py | 17 Listas 1.py | py | 761 | python | pt | code | 0 | github-code | 6 |
30097122943 | """ Comments scraper class"""
import json
import logging
import random
from time import sleep
import numpy as np
import pandas as pd
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from scr... | ScrPzz/InstagramScraper | src/comments_scraper.py | comments_scraper.py | py | 4,554 | python | en | code | 2 | github-code | 6 |
73815165306 | from random import random
from time import time
from cachier import cachier
@cachier(next_time=True)
def _test_int_pickling(int_1, int_2):
"""Add the two given ints."""
return int_1 + int_2
def _test_int_pickling_compare(int_1, int_2):
"""Add the two given ints."""
return int_1 + int_2
def test_p... | python-cachier/cachier | tests/speed_eval.py | speed_eval.py | py | 1,903 | python | en | code | 470 | github-code | 6 |
14979508665 | """
Funny Strings Problem on HackerRank
Problem Link: https://www.hackerrank.com/challenges/funny-string/problem
Author: Shyam Kumar (@svshyam91)
"""
def funnyString(s):
# Make the list of ascii of characters of string
ascii_str=[ord(c) for c in s]
ascii_str_rev=ascii_str[::-1] ... | svshyam91/hacker_rank_solutions | funny_string.py | funny_string.py | py | 676 | python | en | code | 0 | github-code | 6 |
392386374 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# random data
A = [2,5,7,9,11,16,19,23,22,29,29,35,37,40,46]
b = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
# Visualize data
plt.plot(A,b,'ro')
# array to [[ ]]
# change row vector to column vector
A = np.array([A]).T
b = np.array([b]).T
# Create ve... | suanthuy/AI_Project | Unit3.1_linear.py | Unit3.1_linear.py | py | 773 | python | en | code | 0 | github-code | 6 |
27610406237 | from flask import Flask, request, render_template, redirect, flash, session
from flask_debugtoolbar import DebugToolbarExtension
from surveys import surveys, satisfaction_survey, personality_quiz
app = Flask(__name__)
app.config['SECRET_KEY'] = "secret_code_here"
# app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
#... | Tetyana-I/flask-survey | app.py | app.py | py | 3,204 | python | en | code | 0 | github-code | 6 |
73652466109 | class Solution(object):
res = []
def postorder(self, root):
"""
:type root: Node
:rtype: List[int]
"""
self.res = []
self.postorder_find(root)
return self.res
def postorder_find(self, root):
if root == None:
return
for... | xxxxlc/leetcode | tree/postorder.py | postorder.py | py | 430 | python | en | code | 0 | github-code | 6 |
7824439491 | #LIBRERIAS A UTILIZAR
import pandas as pd
from sklearn.impute import SimpleImputer
import numpy as np
from sklearn.preprocessing import LabelEncoder
import matplotlib.pyplot as plt
import seaborn as seabornInstance
from sklearn.model_selection import train_test_split #libreria para poder separar los datos entr... | alextsosa17/Analisis-de-Datos-y-prediccion--Python | TpFinalAlexSosa.py | TpFinalAlexSosa.py | py | 6,299 | python | es | code | 0 | github-code | 6 |
3508302141 | #!/usr/bin/env python3
class Tile:
def __init__(self, x: int, y: int):
self._x = x
self._y = y
self._c = 'W'
self._nc = None
def nw(self):
return self._x - 1, self._y - 1
def ne(self):
return self._x + 1, self._y - 1
def sw(self):
return self.... | pboettch/advent-of-code | 2020/24.py | 24.py | py | 3,821 | python | en | code | 1 | github-code | 6 |
25875832480 | #!/usr/bin/env python
# This is more of a work in progress, but this script will
# test the code for creating vespagrams with our curved wavefront correction.
import obspy
import numpy as np
import time
import matplotlib.pyplot as plt
import circ_array as c
from circ_beam import Vespagram_Lin, Vespagram_PWS, Baz_ves... | eejwa/Array_Seis_Circle | examples/Vespagram_test.py | Vespagram_test.py | py | 4,213 | python | en | code | 7 | github-code | 6 |
72344006587 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import datasets
import utils
FLAGS = tf.flags.FLAGS
def get_lr(global_step, base_lr, steps_per_epoch, # pylint: disable=missing-docstring
decay_epochs, lr_decay_factor, w... | google/revisiting-self-supervised | trainer.py | trainer.py | py | 4,425 | python | en | code | 349 | github-code | 6 |
6605463296 | from itertools import combinations
from collections import Counter
def solution(orders, course):
answer = []
for c in course:
temp = []
for order in orders:
combi = combinations(sorted(order), c)
temp += combi
counter = Counter(temp)
if len(counter) != 0 and max(counter.values()) != 1:
... | JeongGod/Algo-study | 3people/6week/p72411.py | p72411.py | py | 457 | python | en | code | 7 | github-code | 6 |
17532275577 | import backtrader as bt
import backtrader.analyzers as btanalyzers
import matplotlib
import matplotlib.dates as mdates
from matplotlib import pyplot as plt
from datetime import datetime
import pandas as pd
import datetime as dt
# Create a subclass of Strategy to define the indicators and logic
class SMA_CrossStrategy(... | erkundanec/Trading_Strategies | 04_Backtest_Backtrader_SMA_CrossOver.py | 04_Backtest_Backtrader_SMA_CrossOver.py | py | 3,013 | python | en | code | 0 | github-code | 6 |
26246786176 | import argparse
import logging
from typing import List
import torch
import torch.nn as nn
from .probe_base import ProbeBase
logger = logging.getLogger(__name__)
class OneWordNNProbe(ProbeBase):
"""
Computes all squared L2 norm of n words as depths after an MLP projection.
Can be used for probing the de... | VSJMilewski/multimodal-probes | probing_project/probes/one_word_nn_probe.py | one_word_nn_probe.py | py | 2,291 | python | en | code | 10 | github-code | 6 |
19849966124 | #7.7.1.py
# This program calculate sthe hourly rate and number of hours worked per week
def main():
print("This program gives wages earned in a week period.")
rate = float(input("What is the hourly rate? "))
numberHours = float(input("How many hours were worked? "))
# determines if overtime pay is inc... | mochapup/Python-Programming-2nd-edition-John-Zelle | 7.7.1.py | 7.7.1.py | py | 661 | python | en | code | 1 | github-code | 6 |
43573832015 | import argparse
from experiment.monitor import monitor
from apps.qe import qe
if __name__ == '__main__':
parser = argparse.ArgumentParser()
monitor.setup_run_args(parser)
qe.setup_run_args(parser)
args, extra_args = parser.parse_known_args()
app_conf = qe.QuantumEspressoAppConf(args.node_count, a... | geopm/geopm | integration/experiment/monitor/run_monitor_qe.py | run_monitor_qe.py | py | 440 | python | en | code | 79 | github-code | 6 |
17233943864 | # coding: utf-8
"""
Refinery Calc API Documentation
Integrate the powerful Refinery Calc Engine into your process using this API. # noqa: E501
OpenAPI spec version: 1.0
Contact: support@refinerycalc.com.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
impor... | refinerycalc/sdk-example-python | python/refinerycalc/models/output_types.py | output_types.py | py | 19,790 | python | en | code | 0 | github-code | 6 |
6173790975 | import csv
import sqlite3
import numpy as np
import pandas as pd
from nltk.stem.porter import *
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
import string
from PIL import Image
from os import path
import matplotlib.pyplot as plt
import matplotlib as mpl
import pickle
from sklearn.svm impor... | zzhang83/Yelp_Sentiment_Analysis | Scripts/UI.py | UI.py | py | 6,335 | python | en | code | 20 | github-code | 6 |
71568070268 | nums = []
user_input = input('Enter numbers: ')
while (user_input != 'exit'):
nums.append(user_input)
user_input = input('Enter numbers: ')
#tokens = user_input.split() # converts numbers to string
# # Convert strings to integers
# nums = []
# for token in tokens:
# nums.append(token)
print(nums)
#
# # P... | Git-Pierce/Week8 | ModifyList.py | ModifyList.py | py | 757 | python | en | code | 0 | github-code | 6 |
27624326992 | import ast
import logging
from util import cname, slice_range, node_is_int, valid_int_slice
from errors import TypeUnspecifiedError
from ptype import PType
from settings import DEBUG_INFER
# Need to use this form to resolve circular import.
import check
int_t = PType.int()
float_t = PType.float()
bool_t = PType.bool... | jruberg/Pyty | src/infer.py | infer.py | py | 7,283 | python | en | code | 5 | github-code | 6 |
18659256455 | import asyncpg
from app.main import create_app
from app.settings import Settings
from tests.test_currencies import test_currencies_success
settings = Settings()
async def test_rate_success(aiohttp_client, loop):
currencies = await test_currencies_success(aiohttp_client, loop)
currency = currencies['results'... | ridhid/test_aio | tests/test_rate.py | test_rate.py | py | 1,745 | python | en | code | 0 | github-code | 6 |
39180591311 | # function programe 1
def funadd(e,f):
a=10
b=10
print("e:",e,"f:",f)
print(a+b)
return a+b,e+f
def funsub():
a=20
b=10
print(a-b)
c,d=funadd(4,8)
ff,dd=funadd(14,18)
print("c value:",c)
print("d value:",d)
funsub()
| sameerCoder/pycc_codes | function_basic1_jan2020.py | function_basic1_jan2020.py | py | 272 | python | en | code | 2 | github-code | 6 |
426288510 | entered_string = input('Please enter the string: ')
def string_operations(text):
third_symbol = text[2]
print('Third symbol of this string: {}'.format(third_symbol))
penultimate = text[-2]
print('Penultimate character of this string: {}'.format(penultimate))
first_five = text[:5]
print('First ... | YanaSharkan/Homework | lesson_4_hw_3/task_5_process_string.py | task_5_process_string.py | py | 1,317 | python | en | code | 0 | github-code | 6 |
17510551183 | '''
2 ways:
1. consider all substrings, and use memoization to not reconsider substrings
leetcode
^
abcd
a bcd ab cd abc d abcd .
/ | \
b cd bc d bcd .
n = s.length
helper(mid = 1)
function helper(mid)
if mid == n:
... | soji-omiwade/cs | dsa/before_rubrik/wordbreak_with_tabulation.py | wordbreak_with_tabulation.py | py | 1,195 | python | en | code | 0 | github-code | 6 |
24113556949 | from sys import stderr
from tourney import *
ENGINE = './erastus -i 10000 -w 4'
SCORE_THRESHOLD = .2
START = '0000000000000000000000000xxxxxxxx1'
def puzzle_search():
engine = Engine(ENGINE)
state = START
while 1:
action, log = engine.run(state)
stderr.write('.')
stderr.flush()
... | richardjs/erastus | src/puzzlesearch.py | puzzlesearch.py | py | 1,059 | python | en | code | 1 | github-code | 6 |
23404494402 | """Test the concurrency module."""
from typing import Any
import pytest
from rtasr.concurrency import ConcurrencyHandler, ConcurrencyToken
class TestConcurrencyToken:
"""Test the ConcurrencyToken class."""
@pytest.mark.parametrize("value", [None, "string", True, False, [], {}])
def test_concurrency_to... | Wordcab/rtasr | tests/test_concurrency.py | test_concurrency.py | py | 2,077 | python | en | code | 5 | github-code | 6 |
14629235583 | import numpy as np
import time
import os
import sys
from scipy.stats import poisson, binom
from scipy.special import erf as erf
from admin import make_glob_array
import multiprocessing
# from Sim_show import Sim_fit
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import matplotlib.colors as mcolors
fro... | gerakolt/DireXeno | fit/show.py | show.py | py | 6,250 | python | en | code | 0 | github-code | 6 |
22676158140 | import cv2
import matplotlib.pyplot as plt
import numpy as np
import selectivesearch
from predictors import resnet152
from utils import selectors, nms
import xml.etree.ElementTree as ET
import random
boxes = {}
def getImgReady(img, show=False):
if img is None:
return None
if show:
plt.imshow... | juvu/ImageSearch | test/testPredictorInterface.py | testPredictorInterface.py | py | 3,482 | python | en | code | null | github-code | 6 |
15393426988 | # -*- coding:utf-8 -*-
class Solution:
def GetLeastNumbers_Solution(self, tinput, k):
# write code here
if len(tinput) < k or k <= 0: #他妈的还有这个条件 k不能为0!!!
return []
length = len(tinput)
start = 0
end = length - 1
index = self.partition(tinput, length, start... | shakesVan/Playground | Nowcoder/40.py | 40.py | py | 1,206 | python | en | code | 0 | github-code | 6 |
31533523826 | import math
vineyard_sq_m = int(input())
grapes_kg_per_sq_m = float(input())
wine_litres_needed = int(input())
number_workers = int(input())
difference = 0
litres_wine = 0
litres_per_worker = 0
total_grapes = vineyard_sq_m * grapes_kg_per_sq_m
percent_for_wine = 0.4
grapes_for_wine = total_grapes * 0.4
litres_wine = gr... | iliyan-pigeon/Soft-uni-Courses | programming_basics_python/conditional_statements_more_exercises/harvest.py | harvest.py | py | 801 | python | en | code | 0 | github-code | 6 |
8190287555 | #!/usr/bin/env python3
# Get sequences from NCBI.
# To be called from Snakefile.
# Usage: python windows.py <infile> <outfile> <email> <window_size>
import os
import sys
from Bio import Entrez
from Bio import SeqIO
import pandas as pd
def main():
snpfile = sys.argv[1]
outfile = sys.argv[2]
email = sys.... | mpjuers/SexualSelectionSubstitutions | Scripts/GetData/windows.py | windows.py | py | 1,594 | python | en | code | 0 | github-code | 6 |
25068821679 | import pygame
from math import *
import time
pygame.init()
pygame.display.set_caption("sprite sheet") # sets the window title
screen = pygame.display.set_mode((1000, 800)) # creates game screen
screen.fill((0,0,0))
clock = pygame.time.Clock() #set up clock
#Variables and stuff (Start)------------------------------... | richfls/chess | main9.py | main9.py | py | 11,852 | python | en | code | 0 | github-code | 6 |
16438405840 | # -*- coding: utf-8 -*-
"""
# @file name : target.py
# @author : chenzhanpeng https://github.com/chenzpstar
# @date : 2022-01-09
# @brief : FCOS训练目标类
"""
import torch
import torch.nn as nn
from models.config import FCOSConfig
from models.utils import coords2centers, coords2offsets, decode_coords, resh... | ydlam/Fcos-main | models/target.py | target.py | py | 4,816 | python | en | code | 0 | github-code | 6 |
32506946053 | import fcntl
import logging
import socket
import struct
import urllib.request
from urllib.parse import urlparse
from xml.dom import minidom
from functools import wraps
import urllib.error
import xml
SIOCGIFINDEX = 0x8933 # Get interface index
logger = logging.getLogger(__name__)
class NotRetrievedError(Exception):
... | Blockstream/satellite | blocksatcli/upnp.py | upnp.py | py | 12,542 | python | en | code | 949 | github-code | 6 |
71578007227 | import h5py
import os
from torch.utils.data import Dataset
from DVS_dataload.my_transforms import *
from PIL import Image
import torch
import numpy as np
class DVSGestureDataset(Dataset):
def __init__(self, root, train=True, transform=None):
super(DVSGestureDataset, self).__init__()
self.n = 0
... | langfengQ/MLF-DSResNet | DVS_dataload/DVS_Gesture_dataset.py | DVS_Gesture_dataset.py | py | 1,762 | python | en | code | 8 | github-code | 6 |
11726066534 | # creates the finale report
import sys
import os
import glob
CL_HOME = os.environ['CL_HOME']
obj_folder = CL_HOME + "/testFinale"
las_f = obj_folder + "/finale_las.tsv"
mlas_f = obj_folder + "/finale_mlas.tsv"
blex_f = obj_folder + "/finale_blex.tsv"
ltcode2results = {}
for out_file in glob.glob(obj_folder+"/out_*... | ganeshjawahar/ELMoLex | conll18/py/createFinaleReport.py | createFinaleReport.py | py | 2,523 | python | en | code | 12 | github-code | 6 |
32552302191 | import threading
import wikipedia
from kivy.clock import mainthread
from kivymd.app import MDApp
class MainApp(MDApp):
url = ""
def build(self):
self.title = "Wikipedia-App"
@mainthread
def search(self, text):
t1 = threading.Thread(target=self.get_wiki, args=(text,), daemon=True)
... | Kulothungan16/Example-Kivy-Apps | WikiPedia/main.py | main.py | py | 1,052 | python | en | code | 42 | github-code | 6 |
28382691901 | from .api import genshindb as gdb
def calc_talent_cost(name, current_level, to_level):
"""
Calculate talent cost.
:param name: character name
:param current_level: current level
:param to_level: to level
:return: talent cost dict
"""
if current_level >= to_level:
return None
... | waigoma/genshin-charatraining-supporter | src/cgi-bin/genshin/talent_calculator.py | talent_calculator.py | py | 704 | python | en | code | 0 | github-code | 6 |
70075665148 | #!/usr/bin/env python3
"""
Cache class. In the __init__ method, store an instance of the Redis }
client as a private variable named _redis (using redis.Redis()) and
flush the instance using flushdb.
"""
import redis
from typing import Union, Optional, Callable
from uuid import uuid4
from functools import wraps
def ... | lemejiamo/holbertonschool-backend-storage | 0x02-redis_basic/exercise.py | exercise.py | py | 3,014 | python | en | code | 1 | github-code | 6 |
41011803429 | from os import system
def img():
if x==1:
y=input("enter the name of img")
z=input("u want version y/n if n it will take latest").lower()
if z=='y':
a=input("enter the version eg 0.2")
system(f"docker pull {y}:{a}")
else:
system(f"docker pull {y}... | chirag248/Docker | doc.py | doc.py | py | 3,536 | python | en | code | 0 | github-code | 6 |
41184065609 | THEME_COLOR = "#375362"
FONT=("Arial",15,"italic")
from tkinter import *
from quiz_brain import QuizBrain
class Quizinterface:
def __init__(self,quizbrain:QuizBrain):
self.window= Tk()
self.score=0
self.quiz=quizbrain
#label Score
self.set()
self.label=Label(text=f... | sshanbhag09/PythonBootcamp- | PycharmProjects/Day34FurtherChanged/ui.py | ui.py | py | 2,730 | python | en | code | 0 | github-code | 6 |
17534123607 | class Programmer:
"""
"""
def __init__(self, name: str, language: str, skills: int):
self.name = name
self.language = language
self.skills = skills
def watch_course(self, course_name, language, skills_earned) -> str:
"""
check if player knows the language, so th... | emilynaydenova/SoftUni-Python-Web-Development | Python-OOP-Oct2023/Exercises/01.First Steps in OOP/07.Programmer.py | 07.Programmer.py | py | 1,498 | python | en | code | 0 | github-code | 6 |
44592268706 | # **************************************************************************
# *
# * Authors: J.L. Vilas (jlvilas@cnb.csi.es) [1]
# *
# * [1] Centro Nacional de Biotecnologia, CSIC, Spain
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public Li... | I2PC/scipion-em-xmipptomo | xmipptomo/protocols/protocol_crop_tomograms.py | protocol_crop_tomograms.py | py | 6,045 | python | en | code | 4 | github-code | 6 |
6020834834 | import os
import cv2
import shutil
source_path = 'test_copy_image'
des_path = 'train_image_label'
def get_all_label_file_to_image_file():
list_file = os.listdir(source_path)
list_label = [file for file in list_file if file.endswith('.txt')]
return list_label
def copy_image_according_to_label():
label... | hluong89/calc_bounding_box_YOLO | copy_image_according_to_labels.py | copy_image_according_to_labels.py | py | 1,014 | python | en | code | 1 | github-code | 6 |
34776536653 | from django.http import JsonResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
from django.urls import reverse
from ..filters.CRPFilter import CRPFilter
from ..forms.CRPForm import UpdateCRPForm, CRPTrackForm, AddCRPForm
from django.forms import modelformset_factory
from datetime import datet... | nazmul53p/ERP | productionplanning/views/CRPViews.py | CRPViews.py | py | 14,011 | python | en | code | 1 | github-code | 6 |
12578258527 | class Task:
def __init__(self, id, description):
self.id = id
self.description = description
class TaskList:
def __init__(self, file_name):
self.file_name = file_name
self.tasks = []
self.load_tasks()
def load_tasks(self):
try:
with open(self.fi... | EltonLunardi/Projetos_pequenos | CRUDSimples/crud.py | crud.py | py | 2,863 | python | pt | code | 0 | github-code | 6 |
41364868505 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 11:56:58 2019
@author: saransh
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans,AgglomerativeClustering,DBSCAN
from sklearn.datasets import load_digits
from sklearn.decomposition impor... | Saransh0905/Data-Science-3 | agglomerativeClustering and DBSCAN/lab11.py | lab11.py | py | 3,419 | python | en | code | 1 | github-code | 6 |
31533884286 | actor_name = input()
points_from_academy = float(input())
number_of_evaluators = int(input())
total_points = points_from_academy
total_evaluator_points = 0
difference = 0
is_nominated = False
for evaluator in range(number_of_evaluators):
evaluator_name = input()
evaluator_points = float(input())
total_evalu... | iliyan-pigeon/Soft-uni-Courses | programming_basics_python/for_loops/oscars.py | oscars.py | py | 741 | python | en | code | 0 | github-code | 6 |
5432983759 | import logging
import warnings
from typing import List, Tuple
import numpy as np
import pandas as pd
from anndata import AnnData
from mudata import MuData
from pandas.api.types import is_numeric_dtype
from sklearn.neighbors import KNeighborsClassifier
from ..utils import check_transition_rule, get_views_from_structur... | Teichlab/multi-view-atlas | src/multi_view_atlas/tl/map_query.py | map_query.py | py | 11,557 | python | en | code | 0 | github-code | 6 |
8633193297 | '''
Exercise 5
Take two lists, say for example these two:
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
and write a program that returns a list that contains only the elements that are common between the lists (without duplicates). Make sure your program works on two l... | kaichunchou/Python-Review | Exercise_5/Exercise_5.py | Exercise_5.py | py | 1,255 | python | en | code | 0 | github-code | 6 |
19624665111 | # -*- coding: utf-8 -*-
import math
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render, redirect
from django.contrib import messages
# Create your views here.
from django.urls impor... | drhtka/prifile | main/views.py | views.py | py | 21,683 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.