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
23175990731
from bergen.console import console from bergen.schema import Node from bergen.graphical import GraphicalBackend class Interaction: def __init__(self, node: Node) -> None: self.node = node async def graphical_assign(self): from bergen.ui.assignation import AssignationUI with console.s...
jhnnsrs/bergen
bergen/contracts/interaction.py
interaction.py
py
713
python
en
code
0
github-code
90
18235028162
from django.shortcuts import redirect from django.utils.encoding import smart_str from django.contrib.sites.shortcuts import get_current_site from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode from django.urls import reverse from django.contrib.auth.tokens import PasswordResetTokenGenerator from...
samadaderinto/e-commerce-backend
codematics/core/views.py
views.py
py
21,024
python
en
code
1
github-code
90
1608358740
from kivymd.app import MDApp from kivy.lang.builder import Builder from kivy.properties import StringProperty, ListProperty from kivymd.uix.list import MDList,OneLineIconListItem from kivymd.theming import ThemableBehavior from kivy.uix.boxlayout import BoxLayout from kivy.uix.screenmanager import ScreenManager, Scree...
simofane4/transapp
mangement/main.py
main.py
py
3,219
python
en
code
0
github-code
90
42888975081
import os, re, torch from collections import defaultdict, OrderedDict from mmsc.datasets.base_dataset import BaseDataset from mmsc.utils.dataset import load_video _CONSTANTS = { 'dataset_name': 'voxceleb2', 'wave_ext': 'wav', 'face_ext': 'jpg', 'face_folder': 'aligned_faces', 'video_ext': 'mp4'...
zcxu-eric/AVA-AVD
model/mmsc/datasets/builders/voxceleb2/dataset.py
dataset.py
py
5,233
python
en
code
32
github-code
90
19586753164
#!/usr/bin/python ################################## # getrange.py - Get distance reading from ultrasonic range detector # on GPIO pins GPIO_TRIGGER_F and GPIO_ECHO_F # # HISTORICAL INFORMATION - # # 2016-xx-xx Eric/Mike Created for Raspberry pi # 2017-02-04 msipin Adapted to C.H.I.P. by replacing G...
rhazzed/potatoCHIP
getrange.py
getrange.py
py
3,598
python
en
code
0
github-code
90
26496706878
# L)백준2447_별 찍기 - 10 # https://www.acmicpc.net/problem/2447 # 문제 # 재귀적인 패턴으로 별을 찍어 보자. N이 3의 거듭제곱(3, 9, 27, ...)이라고 할 때, 크기 N의 패턴은 N×N 정사각형 모양이다. # 크기 3의 패턴은 가운데에 공백이 있고, 가운데를 제외한 모든 칸에 별이 하나씩 있는 패턴이다. # *** # * * # *** # N이 3보다 클 경우, 크기 N의 패턴은 공백으로 채워진 가운데의 (N/3)×(N/3) 정사각형을 크기 N/3의 패턴으로 둘러싼 형태이다. 예를 들어 크기 27의 패턴은 예제...
hamin2065/PnP-Algorithm
Week 2/L)백준2447.py
L)백준2447.py
py
1,363
python
ko
code
0
github-code
90
43940853851
# -*- coding: utf-8 -*- import numpy as np import pandas as pd from tqdm import tqdm import os # 存储数据的根目录 ROOT_PATH = "./data" # 比赛数据集路径 DATASET_PATH = ROOT_PATH + '/wechat_algo_data1/' # 训练集 USER_ACTION = DATASET_PATH + "user_action.csv" FEED_INFO = DATASET_PATH + "feed_info.csv" FEED_EMBEDDINGS = DATASET_PATH + "fee...
crayonyon/wechat-big-data-game
prepare_data.py
prepare_data.py
py
9,889
python
en
code
0
github-code
90
9769635982
from django.contrib import admin from .models import (Challenge, Solution,) from .forms import (ChallengeForm, SolutionForm,) class SolutionInline(admin.TabularInline): model = Solution fields = ['text','is_correct',] extra = 0 class ChallengeAdmin(admin.ModelAdmin): form = ChallengeForm list_display = ('title'...
saraivaufc/askmath
competition/admin.py
admin.py
py
630
python
en
code
0
github-code
90
35024302777
#!/usr/bin/env python3 """Somewhat automated crawler using the YTCrawl library.""" # pylama:ignore=E501 # Note that the common import also checks for Python 3 from common import youtube_id_from_cmdline, log, rel_path # Make sure these parameters can be imported from another script BATCH_FILE = rel_path("batch_ytid....
CraigKelly/youtube-data
do_crawl.py
do_crawl.py
py
907
python
en
code
4
github-code
90
75053607656
# -*- coding: utf-8 -*- import pandas as pd import os from rdkit import Chem from tqdm import tqdm from autotemplate.run_utils import clearIsotope, RemoveReagent from autotemplate.extract_utils import canon_remap import matplotlib.pyplot as plt import CGRtools plt.rcParams["figure.dpi"] = 400 from matplotli...
Lung-Yi/AutoTemplate
post_analysis.py
post_analysis.py
py
5,677
python
en
code
2
github-code
90
44772195734
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from search_func import search_query, get_data_by_id app = FastAPI() # Configure CORS app.add_middleware( CORSMiddleware, allow_origins=['*'], # Allow all origins allow_credentials=True, allow_methods=["*"], # Allow all m...
bhattaraisushma/DataB
backend/main.py
main.py
py
1,099
python
en
code
0
github-code
90
73579975978
import time import numpy as np import dfibers.numerical_utilities as nu import itertools as it import matplotlib.pyplot as plt import dfibers.fixed_points as fx class FiberTrace: """ A record of fiber traversal. Has fields: status: "Terminated" | "Closed loop" | "Max steps" | "Timed out" | "Critical" ...
garrettkatz/directional-fibers
dfibers/traversal.py
traversal.py
py
12,381
python
en
code
1
github-code
90
18543606289
def main(): N, C = map(int, input().split()) sushis = [(0, 0) for _ in range(N)] for i in range(N): x, v = map(int, input().split()) sushis[i] = (x, v) ls, rs = 0, 0 left = [(0, 0) for _ in range(N+1)] right = [(0, 0) for _ in range(N+1)] for i in range(N): ls += sush...
Aasthaengg/IBMdataset
Python_codes/p03372/s015911268.py
s015911268.py
py
817
python
en
code
0
github-code
90
40384396780
import onnx_graphsurgeon as gs import numpy as np import onnx scale_const = gs.Constant(name="scale_const_1", values=np.ones(shape=(63,), dtype=np.float32)) bias_const = gs.Constant(name="b_const_1", values=np.zeros(shape=(63,), dtype=np.float32)) @gs.Graph.register() def replace_with_instancenormalization(self, inpu...
BraveLii/trt-hackathon-swin-transformer
scripts/merge.py
merge.py
py
2,136
python
en
code
4
github-code
90
25828981553
import torch import torch.nn as nn import torch.nn.functional as F import torchvision.models as models class ResNet(nn.Module): def __init__(self, dataset, multi_loss, base_model, out_dim): super(ResNet, self).__init__() self.resnet_dict = {"resnet18": models.resnet18(pretrained=False), ...
mozzielol/Hybrid
Hybrid_as_aug/models/resnet.py
resnet.py
py
1,613
python
en
code
0
github-code
90
22550662416
import jinja2 import requests from time import sleep from PIL import Image import urllib.request import qrcode from io import BytesIO from base64 import b64encode ENV = jinja2.Environment(extensions=['jinja2.ext.loopcontrols']) class NFT: def __init__(self, contract_addr, id): self.contract_addr =...
realjohnward/NFT-Framer
NFT_Framer/app/template_filters/filters.py
filters.py
py
1,735
python
en
code
1
github-code
90
13090914335
class Solution: def maxProfit(self, prices: List[int]) -> int: minSoFar = prices[0] maxProfit = 0 for price in prices: if (price < minSoFar): minSoFar = price currProfit = price - minSoFar if (currProfit > maxProfit): maxPro...
magdumsuraj07/data-structures-algorithms
questions/striever_SDE_sheet/6_best_time_to_buy_and_sell_stock.py
6_best_time_to_buy_and_sell_stock.py
py
362
python
en
code
0
github-code
90
18494277069
import sys input = sys.stdin.buffer.readline from collections import defaultdict import copy def main(): N,M = map(int,input().split()) d = defaultdict(int) MOD = 10**9+7 R = 10**5+100 fac = [0 for _ in range(R+1)] fac[0],fac[1] = 1,1 inv = copy.deepcopy(fac) invfac = copy.deepcopy(fac)...
Aasthaengg/IBMdataset
Python_codes/p03253/s901379470.py
s901379470.py
py
974
python
en
code
0
github-code
90
1495599402
#!/usr/bin/env python import csv import numpy as np from threading import Thread, current_thread from subprocess32 import Popen, PIPE from datetime import datetime import matplotlib.pyplot as plt from scipy.signal import convolve2d from skimage.transform import rotate from skimage import filters import time import cv2 ...
arihanv/croplands_optimization
pySOT_torch.py
pySOT_torch.py
py
8,715
python
en
code
0
github-code
90
22383454857
import pickle class DiskIO: def __compress_1_number_vbe(self, number): binary = bin(number)[2:] res = '' i = 0 while len(binary) > 7: res = '0' + binary[len(binary) - 7:] + res binary = binary[:len(binary) - 7] i += 1 res = '1...
borchaniz/search_index_compression
DiskIO.py
DiskIO.py
py
3,919
python
en
code
0
github-code
90
22813410929
#!/usr/bin/env python3 # encoding: utf-8 import os from nose import with_setup from nose.plugins.skip import SkipTest from tests.utils import * SOURCE = ''' #include <stddef.h> #include <stdlib.h> #include <stdio.h> int main(int argc, char *argv[]) { puts("Hello rmlint. Why were you executing this?"); retur...
sahib/rmlint
tests/test_types/test_nonstripped.py
test_nonstripped.py
py
2,125
python
en
code
1,672
github-code
90
19368287658
# coding: utf-8 # modified from https://github.com/minzwon/self-attention-music-tagging import os import numpy as np from torch.utils import data import pickle as pkl import librosa import warnings import math class AudioFolder(data.Dataset): def __init__(self, input_length, # [s] ...
marinelliluca/transformer-based-music-auto-tagging
training/data_loader.py
data_loader.py
py
5,802
python
en
code
3
github-code
90
21180559486
class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: sub_boxes = collections.defaultdict(set) rows = collections.defaultdict(set) cols = collections.defaultdict(set) row_num = len(board) col_num = len(board[0]) #Each row must contain the digits 1-9...
Tettey1/A2SV
leetcode-solutions/valid-sudoku.py
valid-sudoku.py
py
879
python
en
code
0
github-code
90
302796985
import myokit import myokit.gui from myokit.gui import Qt, QtCore, QtGui, QtWidgets # GUI components # Constants SPACE = ' ' TABS = 4 INDENT = SPACE * TABS BRACKETS = { '(': ')', ')': '(', '[': ']', ']': '[' } BRACKETS_CLOSE = (')', ']') FONT = myokit.gui.qtMonospaceFont() FONT.setPointSize(11) # Co...
myokit/myokit
myokit/gui/source.py
source.py
py
52,152
python
en
code
29
github-code
90
25593921281
from urllib.request import build_opener, HTTPCookieProcessor from http.cookiejar import LWPCookieJar cookie = LWPCookieJar() cookie.load('cookie2.txt', ignore_expires=True, ignore_discard=True) handler = HTTPCookieProcessor(cookie) opener = build_opener(handler) opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Window...
zhimin7/web_spider
01 urllib_demo/cookiejar_demo5.py
cookiejar_demo5.py
py
506
python
en
code
0
github-code
90
11237399510
# pylint: disable=missing-function-docstring, missing-module-docstring # pylint: disable=missing-class-docstring, invalid-name, unused-argument import http import unittest from unittest.mock import patch from parameterized import parameterized from shmelegram import app, db from shmelegram.models import Chat, User, ...
Hukyl/shmelegram
tests/test_api.py
test_api.py
py
5,775
python
en
code
1
github-code
90
13128111659
import sys input= sys.stdin.readline n=int(input()) answer=[] l=[i for i in range(2,n+1)] a= [0]+list(map(int, input().split())) answer.append(1) index=0 m=a[1] while 1 != len(a): index+=m if len(a)<index: index=index//m b=l.pop(index) answer.append(b) m=a[index] print(answer)
koreabeginner96/CodeTest
Simulation/Back_Ballnoon_S3.py
Back_Ballnoon_S3.py
py
305
python
en
code
0
github-code
90
18543939849
import numpy as np N,C = list(map(int, input().split())) XV = [list(map(int, input().split())) for _ in range(N)] X = np.array([0] + [x for x,v in XV]) V = np.array([0] + [v for x,v in XV]) V_cw_cumsum = V.cumsum() right_one_ways = V_cw_cumsum - X V_ccw_cumsum = V[::-1].cumsum()[::-1] left_one_ways = V_ccw_cumsum ...
Aasthaengg/IBMdataset
Python_codes/p03372/s404416571.py
s404416571.py
py
876
python
en
code
0
github-code
90
18454349399
s = int(input()) lst = [s] for i in range(10**6): if int(lst[-1]) & 1 == 0: next_a = lst[-1]/2 if next_a in lst: m = i + 1 break lst.append(next_a) else: next_aa = 3*lst[-1] +1 if next_aa in lst: m = i + 1 break lst...
Aasthaengg/IBMdataset
Python_codes/p03146/s416013601.py
s416013601.py
py
348
python
en
code
0
github-code
90
43514284403
from django.urls import path from myappF23 import views app_name = 'myappF23' # urlpatterns = [ # path(r'', views.index, name='index'), # path('<int:category_no>/', views.detail, name='detail'), # path('aboutwebapp/', views.about, name='about') # ] urlpatterns = [ path('', views.index, name='index')...
Flash-7/DistanceEd
myappF23/urls.py
urls.py
py
1,105
python
en
code
0
github-code
90
2179604531
class Solution: def mergeAlternately(self, word1: str, word2: str) -> str: result = "" for char1, char2 in zip(word1, word2): result += char1 + char2 len1 = len(word1) len2 = len(word2) if len1 < len2: result += word2[len1:len2] ...
wlyu1208/Leet-Code
1769_Minimum_Number_of_Operations_to_Move_All_Balls_to_Each_Box/code.py
code.py
py
411
python
en
code
1
github-code
90
18180636519
#D N=int(input()) X=str(input()) CNT=0 for i in range(N): if X[i]=="1": CNT+=1 NUM=int(X,2) to0_cnt=[0 for i in range(N)] for i in range(1,N): ans=0 num=i while True: cnt=0 for j in bin(num)[2:]: if j=="1": cnt+=1 if cnt==0: br...
Aasthaengg/IBMdataset
Python_codes/p02609/s269902866.py
s269902866.py
py
760
python
en
code
0
github-code
90
34842111844
""" creates a binary search tree """ class Node: def __init__(self, data): self.left = None self.right = None self.data = data def __repr__(self): return f"{self.data}" class BST: def __init__(self): pass def insert(self, root, node): # if there ...
ds-praveenkumar/python-tutorial
datastructures/bst.py
bst.py
py
1,846
python
en
code
0
github-code
90
9139791151
class Solution: def merge(self, intervals): #O(nlogn) intervals.sort(key = lambda i: i[0]) output = [intervals[0]] for start, end in intervals[1:]: lastEnd = output[-1][1] if start <= lastEnd: output[-1][1] = max(lastEnd, end) els...
sohbanm/LeetCode
Lists/Merge Intervals.py
Merge Intervals.py
py
467
python
en
code
1
github-code
90
6126119750
from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) email="" @app.route("/") def index(): return render_template("index.html") @app.route("/signin", methods=['POST', 'GET']) def signin(): if request.method == "POST": try: global email e...
incub4t0r/signin_example
app.py
app.py
py
967
python
en
code
0
github-code
90
45134205093
import os def create_data(data_dir_path, data_file_path): if not os.path.exists(data_dir_path): os.makedirs(data_dir_path) open(data_dir_path, 'w').close() elif not os.path.exists(data_file_path): open(data_file_path, 'w').close() def mess_menue(full_course, data_dir_path): print(...
runinrunin/cooking_helper
src/utils.py
utils.py
py
1,234
python
en
code
0
github-code
90
41586807948
from jira import JIRA from time import sleep import datetime from sys import exit from tkinter.filedialog import askopenfilename, asksaveasfilename import tkinter as tk from tkinter import * from openpyxl import Workbook from openpyxl.styles import Font, PatternFill import os import json # This should be your JIRA ins...
delsakov/JIRA_Tools
Export From JIRA.py
Export From JIRA.py
py
19,410
python
en
code
3
github-code
90
15660278599
""" Retrieve slp, uwnd and uflx data for MERRA via ftp from pre-defined lists of urls. urls were created with the tool at: http://disc.sci.gsfc.nasa.gov/daac-bin/FTPSubset.pl?LOOKUPID_List=MATMNXSLV Files arrive in monthly chunks and are concatenated with cdo .. moduleauthor:: Neil Swart <neil.sw...
swartn/sam-vs-jet-paper
data_retrieval/merra/get_merra_data.py
get_merra_data.py
py
1,373
python
en
code
3
github-code
90
72040022696
# -*- coding: utf-8 -*- """ function top_binarizer() was previously used to create the binary matrix `bmc_mat`. top_binarizer() can be built upon to make a more realistic binary matrix. because currently it is based on rank of market cap. in reality, however, it is more complex. for example, nr 11 will have to ...
jacolind/crinfu
py/function-top_binarizer.py
function-top_binarizer.py
py
956
python
en
code
1
github-code
90
21655010852
import requests from quart import Quart, request import json import copy from datetime import datetime import moment import asyncio import os from time import sleep import uuid from quart_cors import cors import python_pachyderm #////////////////////////////////////////////////////////////////////////////////////////...
theycallmeloki/Edith
interfacer/server.py
server.py
py
8,054
python
en
code
6
github-code
90
43442611975
import os import glob import argparse import torch import torch.nn as nn import torch.optim as optim import argparse from torch.utils.data import DataLoader, Subset, Dataset from torchvision import datasets, transforms from sklearn.model_selection import train_test_split from PIL import Image class SimpleCNN(nn.M...
simula/presimal-sample-submission
run.py
run.py
py
4,620
python
en
code
0
github-code
90
9088105650
import pymysql.cursors from datetime import datetime class mysqlUtil(object): #也可以使用参数进行初始化数据库连接self,host,user,password,db,port,charset def __init__(self): self.host="127.0.0.1" self.user="root" self.password="123456" self.db="parking_system" self.port=3306 self.charset="utf8" self.connection=self.connec...
zhenglinyi/MyCarPlateRecognition
DataBase.py
DataBase.py
py
8,682
python
en
code
1
github-code
90
35753854911
#!/usr/bin/env python arr=[] for i in range(5): name=input() if len(name)>10: continue name=name.replace("FBI","*"); if name.find("*")==-1: continue arr.append(i+1) if arr: print(*arr) else: print("HE GOT AWAY!")
hansojin/python
string/bj2857.py
bj2857.py
py
259
python
en
code
0
github-code
90
26545500864
# https://leetcode.com/problems/kth-largest-element-in-a-stream import heapq from typing import List class KthLargest: def __init__(self, k: int, nums: List[int]): self.k = k self.nums = [num for num in nums] heapq.heapify(self.nums) def add(self, val: int) -> int: ...
peulsilva/leetcode-problems
problems/kth_largest_element_in_a_stream.py
kth_largest_element_in_a_stream.py
py
473
python
en
code
0
github-code
90
5006342605
# evolution.py # (C)2015 # Scott Ernst from __future__ import \ print_function, absolute_import, \ unicode_literals, division import numpy as np from scipy import stats import pandas as pd import plotly.plotly as plotly from plotly import graph_objs as plotlyGraph from plotly import tools as plotlyTools #==...
sernst/MVP_Analysis
src/mlb/analysis/evolution.py
evolution.py
py
7,366
python
en
code
0
github-code
90
19414741112
import numpy as np import tensorflow as tf from tensorflow.keras.layers import Dense , Conv2D, MaxPooling2D , Dropout, Input,Flatten from tensorflow.keras.models import Model from tensorflow.keras.datasets import mnist from tensorflow.keras.utils import to_categorical (x_train, y_train), (x_test, y_test) = mnist.load...
Pavankunchala/Deep-Learning
Tensorflow_Basics/Functional-Model/cnn_functional.py
cnn_functional.py
py
2,139
python
en
code
31
github-code
90
13386701439
#!/bin/python # # Author : Ye Jinchang # Date : 2016-04-14 11:06:13 # Title : 199 binary tree right side view # Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. # # For example: # Given the following binary...
Alwayswithme/LeetCode
Python/199-binary-tree-right-side-view.py
199-binary-tree-right-side-view.py
py
1,252
python
en
code
1
github-code
90
74119952616
# -*- coding: utf-8 -*- """ Created on Thu Jun 7 20:17:55 2018 @author: user 字串索引 """ val=input() for i in range(len(val)): print("Index of '{:}': {:}".format(val[i],i))
junyi1997/TQC_Python
8.第八類/PYD801.py
PYD801.py
py
186
python
en
code
0
github-code
90
12049370544
import uuid import logging from django.conf import settings from django.core.management.base import BaseCommand from kombu import Connection, Exchange, Queue from kombu.mixins import ConsumerMixin from search_engine.crawlers import web_crawler, text_preprocess, process_text_metadata LOGGER = logging.getLogger(__name_...
brunolcarli/seeker
search_engine/management/commands/amqp_consumer.py
amqp_consumer.py
py
3,446
python
en
code
1
github-code
90
39203379176
from tkinter import * class MyWindow: def __init__(self, window): self.label_title = Label(window, text = "My Full Name", fg = "red", font = "verdana") self.label_title.place(x=200, y=40) self.label_firstname = Label(window, text = "Enter Given Name:", fg = "red") self.labe...
SamanthaLapena/58002_OOP
Midterm Exam Problem 2_LAPEÑA.py
Midterm Exam Problem 2_LAPEÑA.py
py
2,117
python
en
code
0
github-code
90
10935925743
import os import logging import pandas as pd import matplotlib.pyplot as plt PRE_PATH = '../data/preprocessed/' LOGS_PATH = '../logs/' PLOTS_PATH = './plots/' logging.basicConfig(format='%(levelname)s - %(asctime)s: %(message)s', datefmt='%d/%m/%Y %H:%M:%S', filename=(LOGS_PATH...
Gonmeso/TFM_Anomaly_Detection
src/EDA/generate_graphs.py
generate_graphs.py
py
2,728
python
en
code
0
github-code
90
72058832937
repetitions = -1 numbers = [0, 12, 15] answer = 0 _sum = 0 print(len(numbers)) print('if you want to stop the program just type 999 in the program') while answer != 999: numbers.append(answer) _sum += answer answer = int(input('Enter a integer: ')) repetitions += 1 print(f'{repetitions} numbers were typ...
vytorrennan/Curso-de-python
ex/old 057 until 064/ex064.py
ex064.py
py
365
python
en
code
0
github-code
90
20259307035
import pygame from pygame import display, event, key, draw from pygame.constants import K_KP0, K_KP1, K_KP2, K_KP3, K_KP4, K_KP5, K_KP6, K_KP7, K_KP8, K_KP9 import math import requests from json import dumps pygame.init() display.set_caption("Place") running = True screen = display.set_mode((900,900)) c_s...
RyroyNotFound/pixel
Place/main.py
main.py
py
2,861
python
en
code
0
github-code
90
11584670283
from typing import List from ..domain.models import Channel, Subscription from ..domain.repositories import ( ChannelRepository, DeviceRepository, MessageRepository, SubscriptionRepository) from ..domain.services import DeliveryService from ..domain.common import RecordList class SubscriptionManager: def ...
knowark/instark
instark/application/managers/subscription_manager.py
subscription_manager.py
py
2,995
python
en
code
2
github-code
90
13942285883
import random pc = random.randint(1,3) i = 0 for i in range(1,4): py = int(input("请输入1:石头 2:剪刀 3:布")) if py > 0 and py < 4: if (py == 1 and pc == 2) or (py == 2 and pc == 3) or (py == 3 and pc == 1): print("玩家赢") elif py == pc: print("平局") else: print("电脑赢") else: print("输入不合法")
nijunge/1807-2
1807/18day/月考编程练习/04.py
04.py
py
342
python
en
code
0
github-code
90
30237009236
from scipy.linalg import hadamard import numpy as np import matplotlib.pyplot as plt import time import cv2 from run_generation import cali_gen """ Plot the calibration images (Hadamard matrix) using open-cv, a faster way than using plt """ T_start = time.time() N = 32 H = hadamard(N) I_vector = np.ones((...
TTimelord/lensless
flatcam/picture_get_cv.py
picture_get_cv.py
py
2,228
python
en
code
0
github-code
90
4397517602
from pyspark.sql import SQLContext, Row from pyspark import SparkContext from pyspark.sql import SQLContext sc=SparkContext() sqlContext = SQLContext(sc) lines = sc.textFile("/home/gpurama/Spark_task/spark-test/product.txt") parts = lines.map(lambda l: l.split("|")) people = parts.map(lambda p: Row(product_id=int(p[...
gopal354/practice
product.py
product.py
py
701
python
en
code
0
github-code
90
22966186871
import random from tkinter import N class Node: def __init__(self, data, next=None): self.data = data self.next = next class LinkedList: def __init__ (self): self.head = None def __str__ (self): node = self.head while node is not None: print (node.data) ...
brandopakel/Python-Data-Structure-and-Algorithm-Practice
linked_list.py
linked_list.py
py
1,797
python
en
code
0
github-code
90
15863486576
''' Created on Mar 8, 2020 @author: ballance ''' import os from typing import Set class RunCtxt(object): """Collects information about what is being run""" def __init__(self): self.rundir = None self.launch_dir = None self.project_cfg = None self.engine = None self...
fvutils/testsuite-runner
src/tsr/run_ctxt.py
run_ctxt.py
py
1,268
python
en
code
1
github-code
90
18072337119
from math import factorial h, w, a, b = map(int, input().split()) MOD = 10**9+7 fact = [1] # 累積乗を作る for i in range(1, h+w-1): fact.append(fact[-1] * i % MOD) # 累積乗の逆元 inv_fact = [pow(fact[-1], MOD-2, MOD)] # x^(-1) = x^(10^9+5) % (10^9+7), フェルマーの小定理 for i in range(h+w-2, 0, -1): # xが最大の場合を求め、後ろ向きに計算していく inv...
Aasthaengg/IBMdataset
Python_codes/p04046/s184490188.py
s184490188.py
py
705
python
ja
code
0
github-code
90
16947863161
""" Count the number of prime numbers less than a non-negative number, n. """ class Solution(object): def countPrimes(self, n): """ :type n: int :rtype: int """ if n < 2: return 0 sieve = [True] * n sieve[0] = False sieve[1] = False ...
iamsuman/algorithms
iv/Leetcode/easy/204_count_primes.py
204_count_primes.py
py
653
python
en
code
2
github-code
90
35480287371
def month_name(month, language): eng_months = { # можно было просто через список и искать по индексу '1': 'january', '2': 'february', '3': 'march', '4': 'april', '5': 'may', '6': 'june', '7': 'july', '8': 'august', '9': 'september', '1...
VladaLukovskaya/Python
lesson19_return_in_functions/month_name.py
month_name.py
py
1,078
python
ru
code
0
github-code
90
830381150
import requests import send_email topic = 'tesla' # Define API key and url of info from NewsAPI along with different parameters of API api_key = "48f8f6d6299f4890a1a651935f6ae891" url = f"https://newsapi.org/v2/everything?q={topic}&" \ "sortBy=publishedAt&" \ "apiKey=48f8f6d6299f4890a1a651935f6ae891&" \ ...
Odinroast/App5-simplewebapi-
main.py
main.py
py
994
python
en
code
0
github-code
90
10024747505
import numpy as np import tensorflow as tf from helpers import * def submission_per_patch(session, graph, images, img_number, window_size, patch_size=16, stride=16, threshold=0.5): ''' :param session: Give a tensorflow session to be run on. :param graph: Give a default graph :param images: test...
KennethThNg/RoadSegmentation
restore_submission.py
restore_submission.py
py
4,182
python
en
code
0
github-code
90
26317636194
import logging from semantic_kernel.orchestration.sk_context import SKContext from semantic_kernel.skill_definition import sk_function, sk_function_context_parameter from gptui.gptui_kernel.manager import auto_init_params mylogger = logging.getLogger("mylogger") class WriteFile: def __init__(self, manager): ...
happyapplehorse/gptui
tests/unit_tests/gptui_kernel/plugins_test_data/FileIO.py
FileIO.py
py
1,090
python
en
code
3
github-code
90
70591359658
from index import db, bcrypt import networkx as nx import numpy as np from sklearn.metrics.pairwise import cosine_similarity from collections import Counter import operator # class User(db.Model): # id = db.Column(db.Integer(), primary_key=True) # email = db.Column(db.String(255), unique=True) # password =...
kajdanowicz/priorityAttachmentWeb
application/models.py
models.py
py
10,679
python
en
code
0
github-code
90
20732862712
from record import Record # work with file to save records class fileWork: def __init__(self, name): self.name = name self.setRecord() # cancel current records and write to the file def zeroFile(self): with open(self.name, "w") as inFile: for i in range(0, 3): ...
VladTkach/Saper_Qt
fileWork.py
fileWork.py
py
1,319
python
en
code
0
github-code
90
72683018858
# 4 folds of OOF and a submission using Catboost by Yandex import numpy as np import pandas as pd from scipy import sparse from sklearn.model_selection import KFold import csv from catboost import CatBoostRegressor pth = '../' out_pth = '../OOF/Catboost6000/' with open(pth + 'sparse-features/fnames.csv', 'r') as csv...
knstmrd/avitodemandprediction
catboost_CV.py
catboost_CV.py
py
2,443
python
en
code
0
github-code
90
29462929523
class aerospace: #creating a class that defines features all aerospace vehicles may have. vehicle_name = "" vehicle_model = "" vehicle_year = "" engine_thrust = "" exit_velocity = "" reusablity = "" def aerospace1(self): make = input("please enter make of the aerospace vehicle\n>>>...
taekionic/Python_Projects
Learning Files/parent-child classes.py
parent-child classes.py
py
2,787
python
en
code
0
github-code
90
13662219152
import pytest from random_name_generator.constants import Descent, Sex @pytest.fixture def mock_first_names(monkeypatch): first_names = { Descent.ENGLISH: { Sex.MALE: [ 'John', 'Joseph' ], Sex.FEMALE: [ 'Ashley' ...
diachkow/python-random-name-generator
tests/conftest.py
conftest.py
py
2,000
python
en
code
1
github-code
90
28230799233
''' Модуль для работы с внутриигровыми объектами. К оным относятся игрок и мобы. ''' import json def get_object(name): ''' Возвращает игровой объект типа name : string в виде словаря: 'name' : string -- название игрового объекта. 'max hp' : int -- максимальный запас здоровья. 'hp' : in...
Mirovengil/RadZombie
class_object.py
class_object.py
py
833
python
ru
code
0
github-code
90
340604860
""" 問題URL: """ import math import sys from collections import deque from typing import Union, List INF = 2 * 10 ** 14 CONST = 998244353 global g global yen_dist global snk_dist global q class Edge(object): def __init__(self, to, yen, snk): self.to = to self.yen = yen self.snk = snk ...
ktaroabobon/AtCoder
練習問題/graph/Dijkstra/soundhound_2018summer_D.py
soundhound_2018summer_D.py
py
3,755
python
en
code
0
github-code
90
42642339817
import cv2 import os import argparse import numpy as np from detection.core.detector_factory import get_detector from detection.tensorpacks.viz import draw_final_outputs def pick_best_faces(detection_results, num): if len(detection_results) == 0: return [] # Trivial solution: just pick the largest f...
houweidong/models
detection/dataset/gen_face_bbox.py
gen_face_bbox.py
py
6,275
python
en
code
0
github-code
90
32484673860
from django.conf.urls import patterns, include, url from group2 import views urlpatterns = patterns('', url(r'^profile/$', views.profile, name='profile'), url(r'^dataStudent/$', views.data_student, name='data_student'), url(r'^dataStudentEdit/$', views.data_student_edit, name='data_student_edit'), ...
tachagon/DB_Project
group2/urls.py
urls.py
py
3,482
python
en
code
0
github-code
90
9051287540
import mxnet as mx import numbers import os import numpy as np import torch import cv2 from torch.utils.data import Dataset from torchvision import transforms from s_data.MaskTheFace.augment_mask import AugmentMask default_trans_list = [ transforms.Resize((112, 112)), transforms.RandomHorizontalFlip(p=0.5), ...
iChenning/face_project
s_data/dataset_mx.py
dataset_mx.py
py
2,087
python
en
code
2
github-code
90
42210199235
from pointraing import db from flask import render_template, url_for, redirect, request, flash, abort, send_from_directory, current_app, Blueprint from flask_login import current_user, login_required from pointraing.students.forms import StudentActivityForm from pointraing.models import Attendance, ActivityType, RateAc...
sumluxgirl/flaskProject
pointraing/students/routes.py
routes.py
py
7,148
python
en
code
0
github-code
90
8059893419
import telebot import os import inspect import sys from PIL import Image import face_recognition import numpy as np from io import BytesIO import random import sqlite3 bot = telebot.TeleBot("2147259007:AAEVsREyP6oCv5-YCxIyk45DyoTtW-4ui1s", parse_mode=None) ORDINATA = ['Ars longa, vita brevis.', ...
yamaha3212/TelegramBot
BorschevickBot.py
BorschevickBot.py
py
4,198
python
en
code
0
github-code
90
17932634580
import torch from torch.optim import Optimizer #Custom Adam Optimizer - extension of Optimizer class class CustomAdam(Optimizer): """ A custom implementation of the Adam optimizer. Defaults used are as recommended in https://arxiv.org/abs/1412.6980 See the paper or visit Optimizer_Experimentation.ipy...
thetechdude124/Adam-Optimization-From-Scratch
CustomAdam.py
CustomAdam.py
py
4,870
python
en
code
4
github-code
90
71996842858
# def solve(string): # for i in range (0, len(string)): # if (string[i] == string[i + 1]): # return True # return False # s = "afternoon" # print(solve(s)) mySet = set() def testFunction(ok, i): if i <= 5: ok.add(i) testFunction(ok,i + 1) testFunction(mySet, 0) print(mySet)
limzhanrong/DSA
test.py
test.py
py
317
python
en
code
0
github-code
90
17952780069
N=int(input()) A = [list(map(int, input().split())) for i in range(N)] result=0 flag=True isbreak=False for m in range(N-1): for n in range(m+1,N): list_t=list(range(N)) list_t.remove(m) list_t.remove(n) for t in list_t: if A[m][n]>A[m][t]+A[t][n]: result=...
Aasthaengg/IBMdataset
Python_codes/p03600/s021799714.py
s021799714.py
py
675
python
en
code
0
github-code
90
25915898301
n1 = float(input(('Primiro valor:'))) n2 = float(input('Segundo valor:')) opcao = maior = 0 while opcao != 5: print(''' [1] somar [2] multiplicar [3] maior valor [4] novos numeros [5] sair''') opcao = int(input('Qual é a sua opção ?')) if opcao == 1: print('{} + {} = {}'.format(n1,...
celycodes/curso-python-exercicios
exercicios/ex059.py
ex059.py
py
939
python
pt
code
2
github-code
90
31676541287
''' VAE model traning for MD data set # the reference for the originial code: Kingma, Diederik P., and Max Welling. "Auto-Encoding Variational Bayes." https://arxiv.org/abs/1312.6114 Michael Feig, Bercem Dutagaci Michigan State University 2022 bioRxiv: ''' from __future__ import absolute_import from __...
bercemd/PolII-mutants
ml_md_vae_training.py
ml_md_vae_training.py
py
6,884
python
en
code
0
github-code
90
13118002639
"""This module contains all of the endpoints for the api.""" from http import HTTPStatus from flask import Blueprint, jsonify, request from flask_restful import Api from flask_jwt_extended import verify_jwt_in_request from app.api.resources import ( ArtistAPI, ArtistListAPI, ArtistByNameAPI, VenueAPI,...
EricMontague/MailChimp-Newsletter-Project
server/app/api/views.py
views.py
py
3,215
python
en
code
0
github-code
90
19272389075
# JOB: open file, get sum of squares of numbers in file # ---------------------------------------------------------------------------- def isInteger(val): """ Returns true if string val is an integer. Note: having floats in strings throws value error. Arguments: val = value to check if integer ...
statisticallyfit/Python
pythonlanguagetutorials/PythonTutorial/JohnZelle_PythonProgramming/Chapter6_Functions/ex14_squareNumbersFromFile.py
ex14_squareNumbersFromFile.py
py
1,670
python
en
code
0
github-code
90
2657447984
"""Drop output file type from database. Revision ID: cd0fd4a20457 Revises: 41608b05c0b1 Create Date: 2022-04-06 21:51:27.162113 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "cd0fd4a20457" down_revision = "41608b05c0b...
opendatalabcz/traffic-surveys-automation
backend/migrations/versions/2022-04-06-21-51-cd0fd4a20457_drop_output_file_.py
2022-04-06-21-51-cd0fd4a20457_drop_output_file_.py
py
735
python
en
code
3
github-code
90
10117337229
import csv def lecture(text): ''' Renvoie une table à partir du fichier csv param : fichier : csv file return : list >>> lecture('pokemon.csv')[0] ['Clic', '60', '80', '95', '50', 'Acier'] ''' file=open(text,'r') table=[] for ligne in file: table.append(ligne.rstrip().sp...
VLesieux/NSI-Premiere
Projet_7_Pokemon/correction_projet_pokemon.py
correction_projet_pokemon.py
py
2,858
python
fr
code
1
github-code
90
24715359292
#!/usr/bin/env python3 import os import sys import re import requests import shutil import subprocess from time import sleep URL_WHITELIST = "https://static.fclaude.net/whitelist-master.txt" URL_SUBDOM = "https://static.fclaude.net/whitelist-subdoms.txt" URL_IPADDR = "https://static.fclaude.net/whitelist-ipaddr...
francois-claude/tracker_ip_finder
resolv.py
resolv.py
py
5,442
python
en
code
0
github-code
90
73979163495
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("register", views.register, name="register"), path('gallery', views.gallery, name='gallery'), ...
xuche123/capstone
imagine/urls.py
urls.py
py
836
python
en
code
0
github-code
90
38736699070
import cv2 import numpy as np import torch #---CLAHE transform--- def clahe(img, clip_limit=2.0, tile_grid_size=(8, 8)): if img.dtype != np.uint8: raise TypeError("clahe supports only uint8 inputs") clahe_mat = cv2.createCLAHE(clipLimit=clip_limit, tileGridSize=tile_grid_size) if len(i...
pjirayu/STOS
utils/transform_img.py
transform_img.py
py
4,708
python
en
code
1
github-code
90
25494840664
import json import requests from elasticsearch import Elasticsearch es = Elasticsearch(hosts=["http://127.0.0.1:9200"]) headers = { "Content-Type": "application/json", "Authorization": "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6IiIsImV4cCI6MTUxNzU4ODQ4OCwidXNlcl9pZCI6MSwidXNlcm5hbWUiOiJsaXNpIn0....
open-cmdb/cmdb
apps/c_test/test/test-6.py
test-6.py
py
717
python
en
code
966
github-code
90
22597710518
import requests from apiclient.discovery import build from apiclient.errors import HttpError class LelKekBot: def __init__(self,token): self.token = token self.apiUrl = "https://api.telegram.org/bot{}/".format(token) def getUpdates(self,offset=None, timeout = 30): method = 'getUpdate...
Kilotary/lel
lolkekbot.py
lolkekbot.py
py
2,444
python
en
code
0
github-code
90
13029472045
# 3'. Задайте список из вещественных чисел. # Напишите программу, которая найдёт разницу между максимальным и минимальным значением дробной части элементов. # *Пример:* # - [1.1, 1.2, 3.1, 5, 10.01] => 0.19 from os import system from random import randint import random system("cls") n = int(input(" сколько в сап...
AH1N/PythonHomeWork
HW_3_28.11.2022.py
HW_3_28.11.2022.py
py
1,025
python
ru
code
0
github-code
90
13087678350
import json from twisted.internet import reactor from binance.websocket.binance_socket_manager import BinanceSocketManager class BinanceWebsocketClient(BinanceSocketManager): def __init__(self, stream_url): super().__init__(stream_url) def stop(self): try: self.close() fin...
June911/WithdrawFromBinance
binance/websocket/websocket_client.py
websocket_client.py
py
2,166
python
en
code
5
github-code
90
18344592019
from itertools import accumulate N, K = map(int, input().split()) S = input() q = [] pre = S[0] ans = cnt = 0 for s in S: if pre != s: q.append(cnt) cnt = 1 pre = s else: cnt += 1 q.append(cnt) J = 2*K+1 acc = list(accumulate(q)) acc += [acc[-1]] if len(q) <= J: ans = acc[-...
Aasthaengg/IBMdataset
Python_codes/p02918/s453647133.py
s453647133.py
py
593
python
en
code
0
github-code
90
9342415473
''' Description: https://blog.csdn.net/weixin_44128857/article/details/117445420 Author: HCQ Company(School): UCAS Email: 1756260160@qq.com Date: 2021-08-03 12:41:16 LastEditTime: 2021-10-17 20:29:10 FilePath: /PCDet/pcdet/datasets/huituo/robosense/robosense_dataset.py ''' import numpy as np import copy import pickle i...
HuangCongQing/pcdet-note
pcdet/datasets/huituo/robosense/robosense_dataset.py
robosense_dataset.py
py
28,527
python
en
code
45
github-code
90
19131016125
import os # readFile and WriteFile from # http://www.cs.cmu.edu/~112/notes/notes-strings.html def readFile(path): with open(path, "rt") as f: return f.read() def writeFile(path, contents): with open(path, "wt") as f: f.write(contents) def findConfig(): # Find the Euro Truck Simulator ...
eh8/jalopy
jalopy/changeSettings.py
changeSettings.py
py
2,466
python
en
code
2
github-code
90
18592717619
#HarshadNumber n = int(input()) def hrsh(x): s = 0 while x > 10: s += x % 10 x = x//10 s += x return s f = hrsh(n) #print(f) if n % f == 0: print('Yes') else: print('No')
Aasthaengg/IBMdataset
Python_codes/p03502/s875164548.py
s875164548.py
py
190
python
en
code
0
github-code
90
37762251953
from django.urls import path from . import views app_name = "api" urlpatterns = [ path('/home', views.home, name='home'), path('/search_links', views.get_links, name='links'), path('/search_images', views.get_images, name='images'), path('/search_pdfs', views.get_pdfs, name='pdfs') ]
Harikrishnan2004/Google_search_api
google_seo_api/urls.py
urls.py
py
312
python
en
code
0
github-code
90
72211279338
N = int(input()) arr = list(map(int, input().split())) arr_tmp = list(set(arr)) result = [] dict_tmp = dict() arr_tmp.sort() tmp = 0 for num in arr_tmp: dict_tmp[num] = tmp tmp += 1 for num in arr: result.append(dict_tmp[num]) print(*result)
khyunchoi/Algo
Boj/python/18870.py
18870.py
py
257
python
en
code
0
github-code
90
41423339336
from flask import Flask, render_template, Response import numpy as np import cv2 import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import tensorflow as tf app = Flask(__name__) @app.route("/") def index(): """Video streaming home page.""" return render_template("index.html") net = tf.keras.models.load_m...
sasuke-ss1/LDR_NET
app.py
app.py
py
1,648
python
en
code
2
github-code
90