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
35821021595
"""Added user table Revision ID: 17e8aa9d283a Revises: Create Date: 2022-11-30 15:50:56.416309 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "17e8aa9d283a" down_revision = None branch_labels = None depends_on = None def upgrade() -> None: op.create_tabl...
brent-stone/fastapi_demo
backend/alembic/versions/17e8aa9d283a_added_user_table.py
17e8aa9d283a_added_user_table.py
py
1,031
python
en
code
1
github-code
90
14285769293
# _*_ coding : UTF-8 _*_ # 开发人员 : ChangYw # 开发时间 : 2019/9/2 15:34 # 文件名称 : NumpyReview02.PY # 开发工具 : PyCharm import numpy as np def thanAvg(score,avg_score): return score if score>avg_score else 0 if __name__ == '__main__': ''' 正态分布 np.random.normal(loc = 0.0,scale = 1.0,size = None) .loc...
wenzhe980406/PythonLearning
day36/NumpyReview02.py
NumpyReview02.py
py
1,225
python
en
code
0
github-code
90
7636960857
import hashlib door_id = 'ugkcyxxp'.encode('utf-8') index = 0 kod = "" while(1): temp = hashlib.md5(door_id + str(index).encode('utf-8)')).hexdigest() if (temp[:5] == '00000'): kod = kod + temp[5] index += 1 if len(kod) == 8: break print(kod)
elnivir/advent_of_code
16/zad5.py
zad5.py
py
278
python
tr
code
0
github-code
90
18118989789
#coding: UTF-8 import math A, B, DEGREE = list(map(int, input().split())) RADIAN = math.radians(DEGREE) C = math.sqrt(A*A+B*B-2*A*B*math.cos(RADIAN)) S =A*B*math.sin(RADIAN)/2.0 H = 2*S/A print("%.10f %.10f %.10f"%(S, A+B+C, H))
Aasthaengg/IBMdataset
Python_codes/p02380/s864895073.py
s864895073.py
py
232
python
en
code
0
github-code
90
18205314579
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N = int(input()) As = [] Bs = [] for _ in range(N): A, B = mapint() As.append(A) Bs.append(B) As.sort() Bs.sort() if N%2==1: left = As[N//2] right = Bs[N//2] else...
Aasthaengg/IBMdataset
Python_codes/p02661/s801792519.py
s801792519.py
py
409
python
en
code
0
github-code
90
25877961232
import numpy as np import matplotlib.pyplot as plt import imageio from numpy.core.fromnumeric import size import module1 as j import matplotlib.pylab as plt j.readIntensity("blue-tungsten.png", "REZ-blue-tungsten", "лампа накаливания", "синий лист") j.readIntensity("green-tungsten.png", "REZ-green-tungsten"...
RudeCow/light
scripts/lightProcessing.py
lightProcessing.py
py
1,157
python
en
code
0
github-code
90
15945375558
import socket import select sk1 = socket.socket() sk1.bind(('0.0.0.0', 8080)) sk1.listen() inputs = [sk1, ] outputs = [] message_dict = {} while True: r_list, w_list, e_list = select.select(inputs, outputs, inputs, 1) print('正在监听的socket对象%d' % len(inputs))
MateriaMedicaCarol/spride-jqueryStudy
socket/fenliser.py
fenliser.py
py
282
python
en
code
0
github-code
90
34975105366
import logging import jinja2 import os import webapp2 from google.appengine.ext import ndb jinja_environment = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) class Photo(ndb.Model): title = ndb.StringProperty() photo_url = ndb.StringProperty() like_count = ndb.Integer...
matthew-cssi/photogram-example
main.py
main.py
py
2,342
python
en
code
0
github-code
90
29383934914
import hashlib def read_file(file_path): with open(file_path, 'rb') as file: file = file.read() return file file1 = read_file('path_to_your_first_file') file1_hash = hashlib.sha256(file1) file2 = read_file('path_to_your_second_file') file2_hash = hashlib.sha256(file2) print(file1_hash.hexdigest())...
mauricedw22/Compare2Files
hash.py
hash.py
py
470
python
en
code
0
github-code
90
17978536819
# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline #文字列入力のときは注意 n = int(input()) g = [[] for _ in range(n)] for i in range(n-1): a,b = [int(i) for i in readline().split()] g[a-1].append(b-1) g[b-1].append(a-1) def dfs(v,p,path): for c in g[v]: ...
Aasthaengg/IBMdataset
Python_codes/p03660/s954387630.py
s954387630.py
py
1,218
python
en
code
0
github-code
90
73410374055
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import subprocess def kill_pid(pid): os.system(f"kill -9 {pid}") def get_pid_by_name(name): cmd = f"kill -9 $(pgrep {name})" # ps aux | grep -v grep | grep qemu | awk '{print $2}' subp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, s...
the-soloist/pwn-toolkit
osys/linux/process.py
process.py
py
821
python
en
code
6
github-code
90
2188099547
""" This is a module for solving the Poisson equation. This module is not currently implemented into the main program. """ __version__ = '0.1' __author__ = 'Daniel Martin' __all__ = ['charge_density', 'E_field', 'material_permittivity', 'potential_deformation', 'solve_poisson'] import numpy as np from scip...
PianoManDanDan/Band-structure-calculation-by-Schrodinger-Poisson-modelling
schrodinger_poisson/poisson.py
poisson.py
py
7,335
python
en
code
2
github-code
90
5453552419
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def splitListToParts(self, head: Optional[ListNode], k: int) -> List[Optional[ListNode]]: cur = head l = 0 ret = [] w...
karthikayan4u/LeetcodeDC
Split Linked List in Parts.py
Split Linked List in Parts.py
py
937
python
en
code
1
github-code
90
18450569949
n, k = map(int, input().split()) A = list(map(int, input().split())) one = [0] * 40 zero = [0] * 40 for i in range(40): for a in A: if a >> i & 1: one[i] += 1 else: zero[i] += 1 dp1 = [-1e10] * 41 # 上から 40 - i 桁目までみたとき、 K と同じ dp2 = [-1e10] * 41 # 上から 40 - i 桁目までみたとき、 K より小さい ...
Aasthaengg/IBMdataset
Python_codes/p03138/s725999539.py
s725999539.py
py
702
python
en
code
0
github-code
90
17406225790
import wradlib as wrl import matplotlib.pyplot as pl import warnings warnings.filterwarnings("ignore") try: get_ipython().magic("matplotlib inline") except: pl.ion() import numpy as np # load radolan files rw_filename = wrl.util.get_wradlib_data_file("../data/raa01-sf_10000-0610300750-dwd---bin") rwdata, rwatt...
technologiestiftung/flusshygiene-inspect-radolan
src/inspector.py
inspector.py
py
1,064
python
en
code
1
github-code
90
1523631887
class Solution: def rotate(self, nums: List[int], k: int) -> None: """ Do not return anything, modify nums in-place instead. """ k = k%len(nums) nums.reverse() nums[:k] = reversed(nums[:k]) nums[k:] = reversed(nums[k:]) print(nums) # if k ...
Chasith-Randima/leetcode
0189-rotate-array/0189-rotate-array.py
0189-rotate-array.py
py
843
python
en
code
0
github-code
90
37157088036
#@author:leacoder #@des: 递归实现 两两交换链表中的节点 ''' 重复处理单元: 两两交换 链表可以分为 待处理 + 当前层正处理(两两交换的两个节点) + 下层递归已处理 下一层递归返回已处理头结点 当前层就知道: 需要交换的 a、b 两节点 以及 后续已处理头节点 递归终止条件: head.next 为 None 可以将 head 为 None 的特殊情况一起做判断 if not head or not head.next: return head 递归前处理(递归到下一层前处理): 这里两两交换链表中的节点 , 下一次递归从 下 两个的结点开始 题 25. K...
lichangke/LeetCode
24. Swap Nodes in Pairs/SwapNodesinPairs_2.py
SwapNodesinPairs_2.py
py
1,785
python
zh
code
8
github-code
90
31221048890
#Write a python program to create a function to find the Min of three numbers. def findmin(n1,n2,n3): if n1<n2: if n1<n3: print(n1 ,"is smallest") elif n2<n3: print(n2, "is smallest") else: print(n3 ,"is smallest") #function calling findmin(int(inp...
Abhishek-Tri/Assignment-20
ans-5.py
ans-5.py
py
423
python
en
code
0
github-code
90
43304477861
from typing import List from fastapi import HTTPException from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from app import models from app import schemas from app import dependencies # from .endpoint_item import artist_endpoint from app.crud.artist import crud_artist router = A...
spankyman125/smp
backend/app/routing/endpoints/artist.py
artist.py
py
1,798
python
en
code
0
github-code
90
5179180488
import libraries from libraries import * ## General utils def get_available_gpus(): local_device_protos = device_lib.list_local_devices() return [x.name for x in local_device_protos if x.device_type == 'GPU'] def save_array(fname, arr): c=bcolz.carray(arr, rootdir=fname, mode='w'); c.flush() def load_array(f...
blancaag/pytorch-resources
utils/utils_functions.py
utils_functions.py
py
21,839
python
en
code
0
github-code
90
69814021738
# coding=utf-8 ''' @ Summary: Platform: imx6ull 1. check part 2. prepare part 3. convert model 4. load lib 5. load to project @ Update: @ file: plugin_imx6ull.py @ version: 1.0.0 @ Author: dkeji627@gmail.com @ Date: 2021/09/29 20:55 @ Update: @ D...
Derekduke/RT-AK-plugin-imx6ull
plugin_imx6ull.py
plugin_imx6ull.py
py
8,858
python
en
code
5
github-code
90
36892023658
class Solution: def frequencySort(self, s: str) -> str: freq = dict() for i in s: freq[i] = freq.get(i, 0) + 1 new_freq = sorted(freq, key=lambda x: freq[x], reverse=True) output = '' for i in new_freq: output += (i * freq[i]) return o...
melegithubyit/competitive-programming
sort_chr_byfreq.py
sort_chr_byfreq.py
py
327
python
en
code
1
github-code
90
42138083028
# tạo 1 sheet mới với cột là date và các user ID sau đó dùng code này để ra được 1 file mới chứa date và từng user id import pandas as pd # Đường dẫn đến file Excel của bạn #file_path = r"C:\Users\Admin\PycharmProjects\decrypt_data\use_08_10_2023_tech.xlsx" file_path = r"C:\Users\Admin\PycharmProjects\decrypt_data\u...
xuannguyen1610/decrypt_data
xulyexcel.py
xulyexcel.py
py
1,219
python
vi
code
0
github-code
90
23985185769
n = int(input()) nums = list(map(int, input().split())) check = sorted(nums) first = 0 second = 0 found1 = False found2 = False j = 1 while j < n: if not found1: if nums[j - 1] > nums[j]: first = j found1 = True else: if nums[j - 1] < nums[j]: second = j ...
birsnot/A2SV_Programming
Sort the array/sort the array.py
sort the array.py
py
622
python
en
code
0
github-code
90
43668951418
# -*- coding: utf-8 -*- """ Created on Thu Nov 7 17:12:08 2019 @author: matth """ """The objective of this program is to create a modified version of autocorrect using sets to determine if a word is contained in a dictionary otherwise the program can drop a letter to see if a word can be made, replace a lett...
matthew-maya-17/CSCI-1100-Computer-Science-1
RPI-CS1100-HW/hw06_files/hw6_part1.py
hw6_part1.py
py
3,021
python
en
code
0
github-code
90
17970491029
_ = input() a = [int(x) for x in input().split()] odd, m4, m2 = 0, 0, 0 for i in a: if i % 2 != 0: odd += 1 elif i % 4 == 0: m4 += 1 else: m2 = 1 else: if odd + m2 - 1 <= m4: print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p03637/s959593634.py
s959593634.py
py
266
python
en
code
0
github-code
90
20301195716
import torch import torch.nn as nn class Dice(nn.Module): """The Dice score. """ def __init__(self): super().__init__() def forward(self, output, target): """ Args: output (torch.Tensor) (N, C, *): The model output. target (torch.LongTensor) (N, 1, *): ...
Tung-I/Kits19_Challenge
src/model/metrics.py
metrics.py
py
1,677
python
en
code
0
github-code
90
21020953721
"""Lomb-Scargle implementation based on the NFFT""" import numpy as np from .utils import complex_exponential_sum def lombscargle_nfft(t, y, dy, f0, df, Nf, center_data=True, fit_mean=True, normalization='standard', exponential_sum_method='auto'): ""...
jakevdp/nfftls
lombscargle/nfftls.py
nfftls.py
py
4,472
python
en
code
3
github-code
90
72904591017
# 第一步,把timestamp+"\n"+密钥当做签名字符串,使用HmacSHA256算法计算签名,然后进行Base64 encode,最后再把签名参数再进行urlEncode,得到最终的签名(需要使用UTF-8字符集)。 import time import hmac import hashlib import base64 import urllib.parse import requests def dingding(api_name): timestamp = str(round(time.time() * 1000)) secret = '哈哈哈哈哈哈哈哈这是个秘密' secret_enc ...
cxhgo/pytestAPI
common/dingding_robot.py
dingding_robot.py
py
1,579
python
en
code
0
github-code
90
11351595309
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="newton_cg", version="0.0.1", author="Severin Reiz", author_email="s.reiz@tum.de", description="A a few cg steps for a newton solver in (convolutional) neural networks", ...
severin617/Newton-CG
setup.py
setup.py
py
797
python
en
code
3
github-code
90
73211774698
# # @lc app=leetcode id=78 lang=python # # [78] Subsets # # @lc code=start class Solution(object): def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ res = [] subset = [] # Draw decision tree to best understand # E...
ashshekhar/leetcode-problems-solutions
78.subsets.py
78.subsets.py
py
839
python
en
code
0
github-code
90
8531453110
import win32com.client import os import pandas as pd from input import * outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case the inbox. You can change that number to reference messages = inbox.Ite...
abhi3700/work-8
main.py
main.py
py
3,017
python
en
code
0
github-code
90
20370403960
# Databricks notebook source # MAGIC %md # MAGIC # MAGIC # Python Version # MAGIC ### Author: Cody Austin Davis # MAGIC ### Date: 2/22/2023 # MAGIC # MAGIC This notebook shows users how to rename/move files from one s3 location/file name to another in parallel using spark. # COMMAND ---------- # MAGIC %pip install ...
AbePabbathi/lakehouse-tacklebox
00-quickstarts/design-patterns/Advanced Notebooks/Parallel Custom Named File Exports/Parallel File Exports - Python Version.py
Parallel File Exports - Python Version.py
py
5,932
python
en
code
21
github-code
90
36834398395
# github.com/b1bxonty # ALL RIGHTS RESERVED # import io import discord import os import json import ftplib import dotenv dotenv.load_dotenv() from discord.ext.commands import Bot, Context #connect bot with all intents #get jobs from ftp server and save variable jobs ftp = ftplib.FTP(os.getenv("ftp_...
AaravMalani/discord_botnet
boss.py
boss.py
py
2,922
python
en
code
0
github-code
90
28788471205
import pandas as pd import numpy as np def df_value_stat(df: pd.DataFrame) -> pd.DataFrame: """return dataframe with following data: columns_name value_range value_range_number dType null_value null_value_% Parameters ---------- df: pd.DataFrame ...
scionuait/StravaDataImport
src/explore_functions.py
explore_functions.py
py
948
python
en
code
0
github-code
90
18216954209
N = int(input()) pl = [] mi = [] for i in range(N): _m = 0 _t = 0 s = input() for c in s: if c == ")": _t -= 1 _m = min(_m, _t) else: _t += 1 if _t > 0: pl.append([-_m, -_t]) # sortの調整のために負にしている else: mi.append([- _t + _m, _m,...
Aasthaengg/IBMdataset
Python_codes/p02686/s238678653.py
s238678653.py
py
1,261
python
ja
code
0
github-code
90
8756065422
from django import forms from django.utils.safestring import mark_safe class AdminImageWidget(forms.FileInput): """ A ImageField Widget for admin that shows a thumbnail. """ def __init__(self, attrs={}): super(AdminImageWidget, self).__init__(attrs) def render(self, name, value, attrs=Non...
ramusus/django-vkontakte-api
vkontakte_api/widgets.py
widgets.py
py
696
python
en
code
15
github-code
90
18215262199
N, K = map(int, input().split()) A = list(map(int, input().split())) dic = {} for i, v in enumerate(A): dic[i+1] = v town = 1 s = set() l = [] for _ in range(K): l.append(town) s.add(town) town = dic[town] if town in s: stop_twon = town break if N <= K: list_first_split = l[:l....
Aasthaengg/IBMdataset
Python_codes/p02684/s162061845.py
s162061845.py
py
491
python
en
code
0
github-code
90
133369878
from machine import Pin import network import webrepl import utime import os from WSLib.nethelp import GetConnection ws_wifi = network.WLAN(network.STA_IF) led = Pin(2, Pin.OUT) if not ws_wifi.isconnected(): ws_wifi.active(True) ws_wifi.connect('Boyz', '27854112Ca') while not ws_wifi.isconnected(): ...
jfmthor/WS32
boot.py
boot.py
py
538
python
en
code
0
github-code
90
33900401875
import requests from flask import Flask from flask import request from flask import Response app = Flask(__name__) @app.route('/') def simulate_stock_price(methods=['GET', 'POST']): stock_symbol = request.args.get('stock') sim_iterations = request.args.get('iterations', default=1000) if stock_sym...
NucleusEngineering/green-pipeline
service-stocksim/main.py
main.py
py
1,505
python
en
code
0
github-code
90
35890913179
import dbconfun as dbfun import datetime as time #기초 데이터 가공 처리 프로세스 #수집해야할 데이터 정보 #매출 테이블 one_data_table = 'm_rawmst' one_data_fild = ['moi_idx','concat(replace(sales_date,\'-\',\'\'),pos_no,rcp_no) as billcode','no_seq','barcode','sale_qty','dc_price','sale_amt','sale_date'] #회원코드 정보 테이블 one_mem_table = 'm_cjsmst' ...
jchuls/python_dev
main_process.py
main_process.py
py
2,533
python
en
code
0
github-code
90
18047527249
def solve(n, s, t): if s == t: return n for common in range(n - 1, 0, -1): if s[-common:] == t[:common]: return 2 * n - common return 2 * n n = int(input()) s = input() t = input() print(solve(n, s, t))
Aasthaengg/IBMdataset
Python_codes/p03951/s405594577.py
s405594577.py
py
245
python
en
code
0
github-code
90
27306246315
from collections import deque n = int(input()) stops = 0 total_fuel = 0 q = deque() for i in range(n): q.append(input()) length = len(q) stops = 0 original_1 = q.copy() while stops != length: fuel, distance = q[0].split(" ") total_fuel += int(fuel) distance = int(distance) if total_fuel >= dis...
MEngMihailTodorov/Softuni_courses
Softuni_Advanced_2022/Advanced/Python_Advanced/01_Lists_as_Stacks_and_Queues_Exercise/05_Truck_Tour.py
05_Truck_Tour.py
py
547
python
en
code
0
github-code
90
4572052864
import os import dotenv dotenv.load_dotenv() from langchain.prompts.chat import ( ChatPromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate, HumanMessagePromptTemplate, ) from langchain.chat_models import ChatOpenAI from langchain.memory import ConversationBufferWindowMemory from...
YanaPIIDXer/LangChainTest
python/main.py
main.py
py
2,009
python
ja
code
0
github-code
90
70593145257
import numpy as np from hyperparameters import PRODUCTION_TRADEOFF from hlt import NORTH, EAST, SOUTH, WEST, STILL def reward(window, production_factor=PRODUCTION_TRADEOFF): """Reward == (own strength - enemy strength) + k * (own prod. - enemy prod.)""" return (np.sum(window[:, :, 0]) - np.sum(window[:, :, 1]...
sselbach/production-seizer
deprecated/reward_deprecated.py
reward_deprecated.py
py
917
python
en
code
0
github-code
90
70193327656
title = "Links" description = """ GtkLabel can show hyperlinks. The default action is to call gtk_show_uri() on their URI, but it is possible to override this with a custom handler. """ from gi.repository import Gtk class LinksApp: def __init__(self): self.window = Gtk.Window() self.window.set_ti...
GNOME/pygobject
examples/demo/demos/links.py
links.py
py
1,754
python
en
code
144
github-code
90
22239300446
class School: def __init__(self, setting_string: str): setting = setting_string.split(" ") self.name = setting[0] self.props = setting[1:] def create_school(): setting_string = input() return School(setting_string) def create_condition(): condition_list = input().split(" + ")...
Ponywen0819/PD01
35.py
35.py
py
2,463
python
en
code
0
github-code
90
9824288630
import pyodbc as py class configscape: Driver = 'SQL Server' Server_name = '(local)' Database_name = 'scape_booking' col_name = ['lati','long','type','hotel_name', 'city_name', 'region_name', 'country_name', 'dest_type','dest_id','hotel_id', 'currency', 'score_wifi', 'score_paid_wifi', '...
Chalermdej-l/Portfolio-Project-Web_Scraping
config.py
config.py
py
2,549
python
en
code
1
github-code
90
18430351909
import sys input = sys.stdin.readline def main(): n = int(input()) ans = [] for i in range(1, n+1): for j in range(i+1, n+1): m = n if n & 1 else n + 1 if i + j != m: ans.append((i, j)) print(len(ans)) for i, j in ans: print(i, j) if __name...
Aasthaengg/IBMdataset
Python_codes/p03090/s685091294.py
s685091294.py
py
349
python
en
code
0
github-code
90
20039577076
#!venv/bin/python import curses import random import time from curses import wrapper from util import * from node import * from util.plotter import * log.info("////////////////////////////////") def wind(x): return math.sin(math.pi * (x - .5)) * .5 + .5 # .5s are horiz shift, squish, and translate up, respec...
brianhouse/pco
main.py
main.py
py
2,615
python
en
code
2
github-code
90
18532972719
from operator import itemgetter n=int(input()) p=[int(input()) for i in range(n)] d=dict() for i in range(n): if p[i]-1 not in d: d[p[i]]=1 else: d[p[i]]=d[p[i]-1]+1 d=list(d.items()) d.sort(reverse=True,key=itemgetter(1)) print(n-d[0][1])
Aasthaengg/IBMdataset
Python_codes/p03346/s864042704.py
s864042704.py
py
251
python
en
code
0
github-code
90
10299428705
from __future__ import division from .. import gpu_utils from ..distributions import * import scipy as s import numpy as np # Import manually defined functions from .variational_nodes import UnivariateGaussian_Unobserved_Variational_Node_with_MultivariateGaussian_Prior # Z_Node_GP class Z_GP_Node(UnivariateGaussian_U...
Starlitnightly/omicverse
omicverse/mofapy2/core/nodes/Z_nodes_GP.py
Z_nodes_GP.py
py
9,248
python
en
code
119
github-code
90
17976522009
import sys def solve(): input = sys.stdin.readline N, K = map(int, input().split()) L = [int(l) for l in input().split()] L.sort(reverse = True) print(sum(L[:K])) return 0 if __name__ == "__main__": solve()
Aasthaengg/IBMdataset
Python_codes/p03658/s461901034.py
s461901034.py
py
237
python
en
code
0
github-code
90
5463841664
""" Write programs that read a line of input as a string and print a. Only the uppercase letters in the string. b. Every second letter of the string. c. The string, with all vowels replaced by an underscore. d. The number of digits in the string. e. The positions of all vowels in the string. """ def checkForUpper(str...
jonasanders1/Python
Lecture-3-whileLoop/differentStrings.py
differentStrings.py
py
2,779
python
en
code
0
github-code
90
23514656268
# memoization & fibo function by recursive (top-down dp) d = [0] * 100 def fibo(x): if x == 1 or x == 2: return 1 if d[x] !=0: return d[x] d[x] = fibo(x-1) + fibo(x-2) return d[x] print(30)
idle-danie/Algorithm
dp/fibo2.py
fibo2.py
py
241
python
en
code
0
github-code
90
74613383655
"""The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3. Find the sum of the only eleven primes that are both truncatable ...
zacharytwhite/project-euler-solutions
project_euler_py/problem_037.py
problem_037.py
py
1,461
python
en
code
0
github-code
90
18222070589
k = int(input()) a, b = map(int,input().split()) count = 0 for i in range(b-a+1): if (i+a)%k == 0: print("OK") count += 1 break if count == 0: print("NG")
Aasthaengg/IBMdataset
Python_codes/p02693/s636330187.py
s636330187.py
py
189
python
en
code
0
github-code
90
71942208617
''' A program to show the closest number of points from the given point. Created on Jul 1, 2017 @author: xhuan ''' import os import argparse from point import point from search import search def main(inputFile, outputFile, targetPoint, count): s = search(inputFile, outputFile, targetPoint, count) ...
xhuanl/UnicornTrackingPython
src/main.py
main.py
py
1,590
python
en
code
0
github-code
90
18485214459
import fractions def lcm(x, y): return (x * y) // fractions.gcd(x, y) n,m = map(int,input().split()) s1=input() s2=input() len_moji = lcm(n,m) len_s1 = [] len_s2 = [] for i in range(n): len_s1.append(i*len_moji//n+1) for i in range(m): len_s2.append(i*len_moji//m+1) #print(len_s1) #print(len_s2) co...
Aasthaengg/IBMdataset
Python_codes/p03231/s622063960.py
s622063960.py
py
674
python
en
code
0
github-code
90
5021156438
import requests import re import string import sqlite3 import os from bs4 import BeautifulSoup as bs dbpath = r"C:\Users\resurrexi\Dropbox\databases" letters = list(string.ascii_uppercase) # Init sqlite connection conn = sqlite3.connect(os.path.join(dbpath, 'mayo.db')) cur = conn.cursor() def val_check(tbl, col, va...
resurrexi/mayo-clinic-scraper
app.py
app.py
py
1,311
python
en
code
4
github-code
90
18216426969
def main(): n,m,k = map(int,input().split()) mod = 998244353 ans = 0 def cmb(n,r,mod): if (r<0 or r>n): return 0 r = min (r, n-r) return g1[n] * g2[r] * g2[n-r] %mod g1 = [1,1] g2 = [1,1] inverse = [0,1] for i in range(2, n+1): g1.append((g1[-1...
Aasthaengg/IBMdataset
Python_codes/p02685/s612365397.py
s612365397.py
py
645
python
en
code
0
github-code
90
26058002846
from django.shortcuts import render,HttpResponseRedirect from django.views import View from requests import request from .models import AllRecipes from .forms import AddRecipe,signinform,signupform from django.core.paginator import Paginator from django.contrib import messages from django.contrib.auth import login,log...
yogeshGit11/Food-Recipe-System
Food_Recipe_System/RecipeApp/views.py
views.py
py
4,110
python
en
code
0
github-code
90
30120145026
# Tuples cannot be manipulated numbers = (1, 2, 3) print(numbers[0]) # Unpacking tuples coordinates = (1, 2, 3) # x = coordinates[0] # y = coordinates[1] # z = coordinates[2] # Same as declared on top x, y, z = coordinates print(x)
blackcode-creator/Introduction-to-python
Tuple/tuple_2.py
tuple_2.py
py
235
python
en
code
0
github-code
90
18047263629
import sys N = int(input()) s = input() t = input() ans = s+t for i in range(N): if s[i:N] == t[0:N-i]: ans = s[0:i]+s[i:N]+t[N-i:N] break print(len(ans))
Aasthaengg/IBMdataset
Python_codes/p03951/s116027306.py
s116027306.py
py
164
python
en
code
0
github-code
90
7219459337
import io import os # from Google import Create_Service import pandas as pd import requests from app.util import * # Flask modules from flask import jsonify, send_from_directory from flask import render_template, request, Response from werkzeug.utils import secure_filename # App modules from app import app from py_da...
app-generator/devtool-python-converter
app/views.py
views.py
py
13,695
python
en
code
12
github-code
90
15945324448
# 不定长参数练习 import html def avg(first, *rest): print(max(rest)) print(max(rest)) return (first + sum(rest)) / (1 + len(rest)) print("avg", avg(1, 2)) print("avg", avg(1, 2, 3, 4)) def make_element(name, value, **attrs): keyvals = ['%s="%s"' % item for item in attrs.items()] attr_str = ''.join(ke...
MateriaMedicaCarol/spride-jqueryStudy
any.py
any.py
py
1,075
python
en
code
0
github-code
90
70932180456
# ADVENT OF CODE 2021 # Challenge #10 # Ethan Kessel SAMPLE_INPUT = """\ [({(<(())[]>[[{[]{<()<>> [(()[<>])]({[<{<<[]>>( {([(<{}[<>[]}>{[]{[(<()> (((({<>}<{<{<>}{[]{[]{} [[<[([]))<([[{}[[()]]] [{[{({}]{}}([{[{{{}}([] {<[[]]>}<{[{[{[]{()[[[] [<(<(<(<{}))><([]([]() <{([([[(<>()){}]>(<<{{ <{([{{}}[<[[[<>{}]...
eqkessel/AdventOfCode2021
solutions/day10/day10.py
day10.py
py
4,162
python
en
code
0
github-code
90
23400137671
#!/usr/bin/python import asyncio import datetime import logging import os import shlex # from asyncio.subprocess import PIPE from subprocess import Popen, PIPE, STDOUT from .aws4auth2.aws4auth_hypersh import AWS4Auth from .docker_client import IDockerProvider _LOG = logging.getLogger(__name__) class HypershClient(I...
zero88/docker_rest
dockerrest/hypersh.py
hypersh.py
py
4,942
python
en
code
0
github-code
90
6201525832
from views.tela_cadastro import TelaCadastros from views.tela_pessoa import TelaPessoa from models.cliente import Cliente from models.funcionario import Funcionario from views.tela_produto import TelaProduto from models.produto import Produto from models.caixa_dao import CaixaDAO class CtrlCadastros: def __init__...
yanocavalcante/posto_gasolina_dso
controllers/ctrlcadastros.py
ctrlcadastros.py
py
16,592
python
pt
code
0
github-code
90
74405108457
import numpy as np import matplotlib.pyplot as plt from matplotlib import style import pickle as pickle from eheanalysis import weighting, plotting, analysis_9yr style.use('/home/brian/IceCube/ehe/ehe_software/ehe_code/EHE_analysis/eheanalysis/ehe.mplstyle') # do this manually... import sys sys.path.append('/home/bria...
clark2668/ehe_studies
studies/2022.07_cuts/weighting_debugging/plot_aeffs_quant_comparison.py
plot_aeffs_quant_comparison.py
py
5,749
python
en
code
0
github-code
90
29373790927
import bisect test_cases = int(input()) for _ in range(test_cases): num, left, right = map(int, input().split()) arr = list(map(int, input().split())) arr.sort() res = 0 def binary_search(num, l, r): while l < r: mid = (l + r) // 2 if num + arr[mid] > righ...
Orion777-cmd/Codeforce-questions
C_Number_of_Pairs.py
C_Number_of_Pairs.py
py
640
python
en
code
0
github-code
90
72024541416
"""Тестирование управления графом""" from __future__ import annotations import pathlib import unittest from core import EventsEmitter from services import GraphService from tests.mocks import ConfigMock from tests.utils import clean_directory CONFIG = ConfigMock() TEST_TVD_NAME = 'moscow' class TestGridControl(unit...
lastick1/rexpert
tests/unit/test_graph_service.py
test_graph_service.py
py
2,393
python
en
code
1
github-code
90
3083942261
import torch from torch.utils.data import Dataset import glob from tqdm import tqdm import numpy as np import pandas as pd import os import re class MotionDataset(Dataset): def __init__( self, datafolder: str, data_num: int = None, train: bool = True, split_ratio: float = 0...
longjianquan/imitation_learning_crane_x7
dataset/motion_dataset.py
motion_dataset.py
py
4,834
python
en
code
0
github-code
90
31122013927
import cv2 import serial import time import gevent ser = serial.Serial() ser.port = 'COM4' ser.baudrate = 9600 ser.open() face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades+'haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades+'haarcascade_eye.xml') smile_cascade = ...
PETERMAOSX/windows_learning_code
Python_/Protect/t2/test2.py
test2.py
py
1,510
python
en
code
0
github-code
90
32111358264
import os import sys import time # print('SOY EL PADRE (PID: %d)' %os.getpid()) # print('..........................') # try: # ret=os.fork() # except OSError: # print('ERROR AL CREAR HIJO') ret=os.fork() while True: if ret>0: print('SOY EL PADRE (PID: %d)' % os.getpid()) sys.exit(0) ...
Satorideemz/Computacion-II
Borradores/procesos3.py
procesos3.py
py
534
python
es
code
0
github-code
90
33972889299
f = open('Day11_input.txt', 'r') # f = open('test.txt', 'r') seats = [] for line in f.readlines(): seats.append([x for x in line.strip()]) def adj_occ(i, j): count = 0 for a in [-1, 0, 1]: for b in [-1, 0, 1]: if a == 0 and b == 0: continue mul = 1 ...
benclmnt/advent-of-code
2020/11.py
11.py
py
1,469
python
en
code
1
github-code
90
45054527298
from cell import Cell, side from constants import width, height import graphics class App: rows = height // side cols = width // side def __init__(self, screen): self.reset(screen) def reset(self, screen): import colors, pygame self.start = None self.stop = None ...
Dawlau/Pathfinding-algorithms-visualizer
Python files/app.py
app.py
py
4,539
python
en
code
0
github-code
90
74019035177
print("Enter the number of elements to be entered") n = (int)(input()) l = list() prefix = list() for x in range(0,n): k = (int)(input()) l.append(k) print("Enter the period") p = (int)(input()) prefix.append(l[0]) for x in range(1,n): prefix.append(l[x] + prefix[x-1]) moving_average = list() moving_aver...
crazycracker/Assignment_7.1
problem_statement_2.py
problem_statement_2.py
py
442
python
en
code
0
github-code
90
25307934092
__author__ = 'nikita_kartashov' from sys import argv import dendropy as dp from unrooted_tree import UnrootedBinaryTree taxa = dp.TaxonSet() def nt(s): return dp.Tree.get_from_string(s, 'newick', taxon_set=taxa, as_unrooted=True) def strip_argument(argument): return argument.strip("\"") def main(): ...
PavelAvdeyev/mgra_estimator
tree_compare/compare.py
compare.py
py
967
python
en
code
1
github-code
90
9533230628
class Solution: def maxProfit(self, prices: List[int]) -> int: maxP=0 curr_min=prices[0] for i in range(len(prices)): if prices[i]<curr_min: curr_min=prices[i] else: profit=prices[i]-curr_min #curr profit is (current ...
anguzz/leetcode
arrays/02-bestTimeBuySellStock.py
02-bestTimeBuySellStock.py
py
592
python
en
code
0
github-code
90
14918164092
# CITATION 1: https://www.youtube.com/watch?v=AGatX_8gaeM # CITATION 2: https://www.youtube.com/watch?v=4k9CphTdnWE # DEPENDENCIES import speech_recognition as sr import os import re import time import webbrowser import random from selenium import webdriver from selenium.webdriver.common.keys import keys import smtpl...
sydneypun/Virtual-Assistant
virtual_assistant.py
virtual_assistant.py
py
4,441
python
en
code
1
github-code
90
18544114699
from bisect import bisect_right,bisect_left N,C=map(int,input().split()) S=[[int(i) for i in input().split()] for i in range(N)] Way1=[S[0][1]-S[0][0]] p1=[] if Way1[0]>0: p1.append(0) for i in range(1,N): Way1.append(Way1[i-1]+S[i][1]-(S[i][0]-S[i-1][0])) if p1==[] and Way1[i]>0: p1.append(i) elif p1!=[]: ...
Aasthaengg/IBMdataset
Python_codes/p03372/s602399752.py
s602399752.py
py
1,129
python
en
code
0
github-code
90
70858509418
# http://python-future.org/compatible_idioms.html from __future__ import print_function from builtins import input from fractions import gcd def gcd_1(a, b): while a != b: if a > b: a -= b else: b -= a return a def gcd_2(a, b): if a == 0: return b re...
vampy/university
fundamentals-of-programming/labs/proposed_3.py
proposed_3.py
py
485
python
en
code
4
github-code
90
26811466551
n = int(input()) points = [] for _ in range(n): x, y = map(int, input().split()) points.append([x, y]) points.append(points[0]) space = 0 for i in range(n): cx, cy = points[i] nx, ny = points[i+1] space += (cx * ny) - (nx * cy) print(round(abs(space)/2, 1))
cyw320712/problem-solving
Baekjoon/python/Geometry/2166.py
2166.py
py
280
python
en
code
3
github-code
90
8028471529
import numpy as np import pandas as pd from sklearn import model_selection, datasets, linear_model, metrics from sklearn.preprocessing import StandardScaler, PolynomialFeatures from sklearn.multioutput import MultiOutputRegressor from sklearn.pipeline import Pipeline import pickle PATH_TO_DATA = 'data/' class BasePre...
GlidingRaven/Juggler
Juggler/Predictors.py
Predictors.py
py
2,951
python
en
code
4
github-code
90
32098368254
''' $Id: raw.py $auth: Steve Torchinsky <satorchi@apc.in2p3.fr> $created: Mon 06 Mar 2023 16:50:10 CET $license: GPLv3 or later, see https://www.gnu.org/licenses/gpl-3.0.txt This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted b...
satorchi/qubicpack
qubicpack/raw.py
raw.py
py
6,934
python
en
code
1
github-code
90
38736647960
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.manifold import TSNE class FeatureVisualize(object): ''' Visualize features by TSNE ''' def __init__(self, features, labels): ''' features: (m,n) labels: (m,) ''...
pjirayu/STOS
utils/feature_viz.py
feature_viz.py
py
1,390
python
en
code
1
github-code
90
40465406208
import cv2 as cv img = cv.imread("/home/praveen/Desktop/Python/Deep Learning/Open CV/Resources/Photos/cat.jpg") def rescaleFrame(frame,scale=0.75): width = int(frame.shape[1]*scale) height = int(frame.shape[0]*scale) dimensions = (width,height) return cv.resize(frame,dimensions,interpolation=cv.INTER...
praveen-kumars/Deep-Learning
Open CV/Basic/imagerescale.py
imagerescale.py
py
439
python
en
code
0
github-code
90
72318626858
from sharetools.models import Membership def get_user_role(location, user): try: obj = Membership.objects.get(location=location, user=user) return obj.role except Membership.DoesNotExist: return None def set_user_role(location, user, role): try: obj = Membership.objects.get(location=location, user=user) e...
dxslly/toolshare
sharetools/manager.py
manager.py
py
1,101
python
en
code
0
github-code
90
18519374769
N=int(input()) A=list(map(int, input().split())) B=[A[i]-i-1 for i in range(N)] B=sorted(B) center=B[N//2] if N%2==1 else round((B[(N-1)//2]+B[(N+1)//2])/2) ans=0 for i in B: ans+=abs(i-center) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03311/s998932274.py
s998932274.py
py
209
python
en
code
0
github-code
90
30337330167
import datetime import hashlib import logging import os import tarfile from azure.storage.blob import BlockBlobService from boto.s3.connection import S3Connection from boto.s3.bucket import Bucket from boto.s3.key import Key import dj_database_url import django # Provides django.setup() from django.apps import apps a...
eallrich/checkniner
scripts/backups/collect.py
collect.py
py
7,635
python
en
code
2
github-code
90
41098669788
from .voc import VOCFSSDataset, VOCSegmentation from .cityscapes import CityscapesFSSDataset from .coco import COCOFSS, COCO, COCOStuffFSS from .ade import AdeSegmentation from .transform import Compose, RandomScale, RandomCrop, RandomHorizontalFlip, ToTensor, Normalize, \ CenterCrop, Resize, RandomResizedCrop, Col...
fcdl94/FSS
dataset/__init__.py
__init__.py
py
3,784
python
en
code
24
github-code
90
16957627933
#!/usr/bin/python3 with open('nomes2.txt', 'r') as arquivo: var = arquivo.readlines() alterado = [] cont = 1 for linha in var: alterado.append('{}-{}\n'.format(linha.strip(), cont)) cont += 1 print(alterado) y = 0 with open('nomenovo.txt', 'w+') as arquivo: for x in alterado: arquivo.write(al...
FurryousCoyote/PythonExercises
modifyarch.py
modifyarch.py
py
347
python
pt
code
0
github-code
90
3042623706
# 输入苹果的单价 price = input('苹果的单价:') # 输入苹果的重量 weight = input('苹果的重量:') # 计算支付的总金额 # 注意两个字符串之间不能用乘法,需要将输入的字符串转换成浮点数 price = float(price) weight = float(weight) money = price * weight print(money)
shi429101906/python
01_python基础/hm_05_买苹果增强版.py
hm_05_买苹果增强版.py
py
319
python
zh
code
0
github-code
90
33381272379
import numpy as np import timm from malpolon.models.standard_prediction_systems import GenericPredictionSystem def test_state_dict_replace_key(): model = timm.create_model('resnet18') sd = model.state_dict() keys = np.array(list(sd.keys())) keys_pos = np.where(np.char.find(keys, 'fc') != -1)[0] ...
plantnet/malpolon
malpolon/tests/test_standard_prediction_systems.py
test_standard_prediction_systems.py
py
661
python
en
code
3
github-code
90
18194266749
class Calc: def __init__(self, max_value, mod): """combination(max_value, all)""" fact = [-1] * (max_value + 1) fact[0] = 1 fact[1] = 1 for x in range(2, max_value + 1): fact[x] = x * fact[x - 1] % mod invs = [1] * (max_value + 1) invs[max_value] ...
Aasthaengg/IBMdataset
Python_codes/p02632/s149981900.py
s149981900.py
py
1,571
python
en
code
0
github-code
90
14758528812
import traceback from alembic import op import sqlalchemy as sa from sqlalchemy import MetaData def where_from(): lines = traceback.format_stack() for line in lines: if 'run_migrations_offline()' in line: mode = 'offline' break if 'run_migrations_online' in line: ...
rb12345/Elm
linotpd/src/upgrades/util.py
util.py
py
2,080
python
en
code
0
github-code
90
1988221869
#Client import socket from cookies import * from ConfigPackage import * def sendCookies(): print("2") RC = ReadConf.RCConf("./ConfigPackage/") print("3") IP = RC.IP PORT = RC.PORT print("4") sendData = googlecookies.getcookies() sendData.append("room_id") sendData.append(str(RC.roo...
ChiMuYuan/DouYuDM
Python/PyBG/DataToServer.py
DataToServer.py
py
681
python
en
code
0
github-code
90
42642232217
import os from collections import OrderedDict from functools import partial from torchvision.transforms import Compose, CenterCrop, Resize, ToTensor, \ RandomHorizontalFlip, Normalize, RandomCrop, RandomRotation from torch.utils.data import DataLoader from attributer.attributes import AttributeType as AT from att...
houweidong/models
attributer/dataset.py
dataset.py
py
10,780
python
en
code
0
github-code
90
31581608493
from pydantic import UUID4, BaseModel, EmailStr, validator from app.models import ServiceTypes class TitleInfoOut(BaseModel): title: str text: str class Config: orm_mode = True @validator('title', 'text', pre=True) def dump_text(cls, v: str): return v.replace('\n', '<br>'...
spectrum-teamwork/certification-center
app/schemas.py
schemas.py
py
1,879
python
en
code
0
github-code
90