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
12078215414
import os import yaml import argparse import torch import matplotlib.pyplot as plt from omegaconf import OmegaConf from bayes_dip.data.datasets.walnut import get_walnut_2d_inner_part_defined_by_patch_size from bayes_dip.utils.evaluation_utils import get_abs_diff, get_ground_truth, get_stddev, translate_path from bayes_...
educating-dip/bayes_dip
evaluation/plot_walnut_mini.py
plot_walnut_mini.py
py
5,646
python
en
code
2
github-code
90
17986940379
n = int(input()) a = list(map(int, input().split())) arr = [0] * 9 ans = [0] * 2 for i in a: if i//400 < 8: arr[i//400] = 1 else: arr[8] += 1 left = sum(arr[:8]) right = arr[8] ans[0] = left if left == 0: ans[0] = 1 ans[1] = left + right print(*ans)
Aasthaengg/IBMdataset
Python_codes/p03695/s402829184.py
s402829184.py
py
285
python
en
code
0
github-code
90
42425644094
""" https://www.codechef.com/problems/GDTURN """ if __name__ == "__main__": n = int(input()) dice = list(list(map(int, input().split())) for i in range(n)) for roll in dice: sum = roll[0] + roll[1] if sum > 6: print("YES") else: print("NO")
vijay2930/HackerrankAndLeetcode
com/codechef/GoodTurn.py
GoodTurn.py
py
301
python
en
code
0
github-code
90
27335828252
import time import numpy as np import pandas as pd import csv from collections import defaultdict import json import os import xlrd label_map_path = "D:\\open_images\\4metadata\\oidv6-class-descriptions.csv" train_label_path = "D:\\open_images\\1human\\oidv6-train-annotations-human-imagelabels.csv" # train_json_file ...
litianqi715/demo_ml
experimental/on_open_images_v6/convert_train_label.py
convert_train_label.py
py
4,059
python
en
code
0
github-code
90
71252908136
from colorama import Fore, init init(autoreset=True) from pandas import read_html from path import path url = "https://www.nytimes.com/interactive/2021/world/india-covid-cases.html" d = read_html(url) d[1].iloc[:,[0,1,2,4,5]].to_csv(path+"csv/current_covid_cases_deaths_india.csv") def table(): print(f"{Fore.CYAN}\...
SinghIsWriting/companion
covid_cases.py
covid_cases.py
py
437
python
en
code
1
github-code
90
2019024979
from flask import Flask, request, render_template import pandas as pd from models.model import preprocessing from models.predict import predict_value app = Flask(__name__) @app.route('/', methods=["GET", "POST"]) def index(): return render_template("index.html") @app.route('/predict', methods = ['...
honey1414/predictionApp
app.py
app.py
py
858
python
en
code
0
github-code
90
12041911258
class SENSOR: STATION=0 LIGHT=1 COMPASS=2 TEMPER=3 ROLL=4 PITCH=5 ACCX=6 ACCY=7 ACCZ=8 ROTX=9 ROTY=10 ROTZ=11 MAGX=12 MAGY=13 MAGZ=14 stationID = 0 basic.show_number(0) stationACK = range(26).fill(0) radio.set_group(79) radio.set_transmit_power(7) # CLIENT: ...
tsiozos/test-remote-sensing-rssi-with-ack
main.py
main.py
py
6,675
python
en
code
0
github-code
90
18356462833
"""Abstract class to define the API for an SPH scheme. The idea is that one can define a scheme and thereafter one simply instantiates a suitable scheme, gives it a bunch of particles and runs the application. """ class Scheme(object): """An API for an SPH scheme. """ def __init__(self, fluids, solids,...
pypr/pysph
pysph/sph/scheme.py
scheme.py
py
58,703
python
en
code
390
github-code
90
25251083629
# coding: utf8 """ --------------------------------------------- File Name: 112-path-sum Description: Author: wangdawei date: 2018/4/25 --------------------------------------------- Change Activity: 2018/4/25 --------------------------------------------- """ # Definition ...
sevenseablue/leetcode
src/leet/112-path-sum.py
112-path-sum.py
py
4,279
python
en
code
0
github-code
90
21716735512
""" Suite of tests to assess "face validity" of spectral analysis functions in spectra.py Usually used to test new or majorly updated functions. Includes tests that parametrically estimate power as a function of frequency, amplitude, phase, n, etc. to establish methods produce expected pattern of results. Plots resul...
sbrincat/spynal
spynal/tests/validity_test_spectra.py
validity_test_spectra.py
py
22,439
python
en
code
8
github-code
90
18544103939
from itertools import accumulate N, C, *xv = map(int, open(0).read().split()) xv = [(x, v) for x, v in zip(*[iter(xv)] * 2)] cw_acc = [0] * (N + 1) ccw_acc = [0] * (N + 1) cw_prev = 0 ccw_prev = C for i in range(N): k = N - i - 1 cw_acc[i + 1] = cw_acc[i] + xv[i][1] - (xv[i][0] - cw_prev) cw_prev = xv[i]...
Aasthaengg/IBMdataset
Python_codes/p03372/s580983874.py
s580983874.py
py
733
python
en
code
0
github-code
90
29718441946
# 多进程修改全局变量 """ 多个进程中,每个进程中所有数据(包括全局变量)都各自拥有一份,互不影响。 想要完成进程间的数据共享,需要一些方法:命名管道/无名管道/共享内存/消息队列/网络等 """ import os import time g_num=100 ret=os.fork() if ret==0: print("-------process-1-------") g_num+=1 print("-------process-1 g_num=%d---"%g_num) else: time.sleep(3) print("-------process-2-------") ...
DorisBian/projectGit
pythonPractice/SystemProgramming-Process/ModifyGlobalVariable.py
ModifyGlobalVariable.py
py
527
python
zh
code
0
github-code
90
18465959439
def solve(): N = int(input()) P = list(map(float, input().split())) dp = [[0]*(N+1) for _ in range(N+1)] dp[0][0] = 1 for i in range(1,N+1): for j in range(i+1): dp[i][j] = dp[i-1][j-1]*P[i-1]+dp[i-1][j]*(1-P[i-1]) ans = sum(dp[-1][N//2+1:]) return ans print(solve())
Aasthaengg/IBMdataset
Python_codes/p03168/s798372895.py
s798372895.py
py
291
python
en
code
0
github-code
90
19981795802
import urllib.request as urr import json import urllib.parse as urp import time data={} def getmovies(data): print("dssd") data['cover']="https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2518852413.jpg" data['cover_x']='960' data['cover_y']='1500' data['id']="2699766...
yaunsine/Python3
catch_translate.py
catch_translate.py
py
860
python
en
code
1
github-code
90
43213375624
# 220413 해결 # 마지막 s 크기가 <= 100000일때는 실패. 시간초과인듯. # c++로 구현해야 하나? 다른 방법이 있을까? # --> 딕셔너리로 t 배열 자리의 알파벳마다 숫자 정해놓고, s에서 글자마다 t에 있는 인덱스를 찾아보기 # 그러다 인덱스 크기가 이전 자리의 인덱스보다 작거나 같으면 n += 1 # 딕셔너리 인덱스 찾아가는 속도가 O(1)일때 총 시간복잡도는 O(n) s = input() t = input() success = 1 n = 1 alphabets_index_t = dict() if set(s) - set(t): # t에 없는 단어...
siejwkaodj/Problem-Solve
Baekjoon/KOI_highschool/20191_줄임말.py
20191_줄임말.py
py
1,049
python
ko
code
1
github-code
90
19276867926
#!/usr/bin/python # -*- coding: utf-8 -*- """ @project: AddressTreeBuilder @author: Jian Sheng @file: BuildTreeByID.py @ide: PyCharm @TIME: 2019-01-10 11:18:19 """ from __future__ import unicode_literals # at top of module from __future__ import division, print_function, with_statement import uuid import pymysql impo...
Jack-Sheng/AddressTreeBuilder
BuildTreeByID.py
BuildTreeByID.py
py
10,795
python
en
code
0
github-code
90
71573576298
#! /usr/bin/env python3 import rospy # Importamos el módulo rospy para interactuar con ROS from geometry_msgs.msg import Twist # Importamos el mensaje Twist para el control de movimiento from grsim_ros_bridge_msgs.msg import SSL # Importamos el mensaje SSL para la comunicación con grSim from krssg_ssl_msgs.msg impor...
janddres/proy-grsim-robocup
grsim_pria.py
grsim_pria.py
py
13,112
python
es
code
0
github-code
90
16364063378
from __future__ import print_function import json, sys, cmd import cPickle as pickle from verifiable_base import VerifiableBase from verifiable_log import VerifiableLog from verifiable_map import VerifiableMap, recalc_tree_hash # Example general purpose verifiable database # Mutation opertions append to its log # Its...
google/certificate-transparency
python/demo/vdb/demo_general_database.py
demo_general_database.py
py
4,825
python
en
code
862
github-code
90
36665105867
CASES = int(input('')) for x in range(CASES): RANGES = input('').split() LW, HR = int(RANGES[0]), int(RANGES[1]) LCM = LW*2 if LCM > HR: print('-1 -1') else: print(LW, LW*2)
ringedSquid/Stuy_CCC_Potd
Codeforces/1389A.py
1389A.py
py
213
python
en
code
0
github-code
90
40395856255
# -*- coding:UTF-8 -*- import urllib.request import urllib.parse url = 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2699817650,1238409640&fm=27&gp=0.jpg' #爬取的时候需要一个头部,自己添加 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/5...
yuansuixin/learn-python-pacong4
c_image.py
c_image.py
py
530
python
en
code
0
github-code
90
18161209339
N = int(input()) As = list(map(int, input().split())) sum = 0 for i in range(N): sum += As[i] sum %= 10**9+7 ans = 0 for i in range(N): sum -= As[i] ans += As[i]*sum ans %= 10**9+7 print(ans)
Aasthaengg/IBMdataset
Python_codes/p02572/s119485925.py
s119485925.py
py
215
python
en
code
0
github-code
90
36136243789
import info class subinfo(info.infoclass): def setTargets(self): ver = "3.0.3" self.targets[ver] = f"https://downloads.sourceforge.net/project/libcsv/libcsv/libcsv-{ver}/libcsv-{ver}.tar.gz" self.targetInstSrc[ver] = 'libcsv-'+ver self.targetDigests[ver] = ("2f637343c3dfac805...
sklnet/craft-blueprints-tellico
libs/libcsv/libcsv.py
libcsv.py
py
656
python
en
code
0
github-code
90
35286946391
import subprocess import os from typing import List from core.util import check_gdb from frontends.tui import Arguments def verify_has_debug_symbols(lib: str) -> None: reallib = os.path.realpath(lib) result = subprocess.run(['file', reallib], check=True, capture_output=True, encoding='utf-8') if 'with deb...
wmww/wayland-debug
backends/gdb_plugin/runner.py
runner.py
py
2,879
python
en
code
56
github-code
90
31686020847
import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import os import glob import torch from sklearn.manifold import TSNE from biopy.datasets import DatasetMultiOmicsGDCTrainTest, DatasetMultiOmicsNatureA549, DatasetMultiOmicsNatureTrainTest from biopy.utils import sample_encodings from biopy....
BioPyTeam/biopy
scripts/visualizer.py
visualizer.py
py
4,782
python
en
code
0
github-code
90
29182171534
rol = str(input("Ingrese tu rut: ")) inverse = rol[::-1] total = 0 for i in range(len(inverse)): total = int(total) + ((i % 6) + 2) * int(inverse[i]) modulo = (total % 11) - 11 print(rol, modulo)
Lucero1867/ejercicios.php
DigitoVerificador.py
DigitoVerificador.py
py
206
python
en
code
0
github-code
90
14296599237
PLUGIN_NAME = 'TheAudioDB cover art' PLUGIN_AUTHOR = 'Philipp Wolfer' PLUGIN_DESCRIPTION = 'Use cover art from TheAudioDB.' PLUGIN_VERSION = "1.3.1" PLUGIN_API_VERSIONS = ["2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6"] PLUGIN_LICENSE = "GPL-2.0-or-later" PLUGIN_LICENSE_URL = "https://www.gnu.org/licenses/gpl-2.0.html...
metabrainz/picard-plugins
plugins/theaudiodb/__init__.py
__init__.py
py
5,963
python
en
code
130
github-code
90
23902075531
import xlrd from connect_db import connect_db book = xlrd.open_workbook("C:/имя файла") sheet = book.sheet_by_name("pos книга в файле") database = connect_db() cursor = database.cursor() query = """INSERT INTO имя таблицы (имя колонки) VALUES (%s, %s)""" for r in range(1, sheet.nrows): Daily_Date = sheet.cell...
besapuz/excel_bd
excel_in_SQL.py
excel_in_SQL.py
py
524
python
ru
code
0
github-code
90
10921442712
############################################################################## # Description # ############################################################################## # This script allows the creation of the query_summary.xlsx file and the # creatio...
LBMC/Fontro_Aube_2019
tRNA_program/enrichiment_report_maker.py
enrichiment_report_maker.py
py
30,880
python
en
code
0
github-code
90
18189274109
from bisect import bisect_right N,M,K = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) #a,bの累積和 A_sum = [0] B_sum = [0] for i in range(N): A_sum.append(A_sum[i]+A[i]) for i in range(M): B_sum.append(B_sum[i]+B[i]) ans = 0 #Aについて0-N冊読む場合の全探索 for i in range(N+1): ...
Aasthaengg/IBMdataset
Python_codes/p02623/s942005296.py
s942005296.py
py
601
python
en
code
0
github-code
90
19255700245
from sys import stdin from collections import deque moving_dir = [[-1, 0, 0], [1, 0, 0], [0, -1, 0], [0, 1, 0], [0, 0, -1], [0, 0, 1]] def bfs(building, floors, rows, cols, cur_row, cur_col, cur_floor): queue = deque() building[cur_floor][cur_row][cur_col] = "-" queue.append([cur_row, cur_col, cur_floor]...
ag502/algorithm
Problem/BOJ_6593_상범 빌딩/main.py
main.py
py
2,456
python
en
code
1
github-code
90
13248935702
from copy import deepcopy s = 0 rules = dict() my_ticket = [] nearby_tickets = [] with open('input.txt', 'r') as f: for line in f: l = line.replace('\n', ' ') if s == 0: if l.isspace(): s = 1 else: splitted = l.split(': ') va...
kovapatrik/advent-of-code-2020
day16/task16.py
task16.py
py
2,268
python
en
code
0
github-code
90
39063706388
from counters.count import add, sub, mul import secondary def hello(): name = input("What is your name: ") print("Hello", name) def main(): hello() x = secondary.foo(1) print(x) print(add(3, 4)) print(sub(3, 4)) print(multiply(3, 4)) if __name__== "__main__": main()
WilliamPyke/vigilant-fortnight
main.py
main.py
py
306
python
en
code
0
github-code
90
12417112382
from random import shuffle import os import pretty_midi as pm import numpy as np import mir_eval.transcription def safe_mkdir(dir,clean=False): if not os.path.exists(dir): os.makedirs(dir) if clean and not os.listdir(dir) == [] : old_path = os.path.join(dir,"old") safe_mkdir(old_path) ...
adrienycart/MLM_decoding
mlm_training/utils.py
utils.py
py
10,758
python
en
code
5
github-code
90
37232690557
''' Given path to training weather data (directory), return mean and std-dev of temperature and PM2.5 Note the weather data covers all districts Arguments: 1) Directory path to training weather data Returns a tuple of (temp_mu, temp_sigma, pm25_mu, pm25_sigma) ''' from __future__ import absolute_import from __future_...
georgesung/ml_competition_didi
preprocess_data/calc_weather_mu_sigma.py
calc_weather_mu_sigma.py
py
1,437
python
en
code
5
github-code
90
70123534056
''' Created_by : Anand Tiwari Created_At : 20/02/2018 Description : This is the implimnetation of K-NeirestNeighbour Algorithm. I have used MNIST data to to impliment this algorithm. KNN is both classification and regression algorithm. In classification, we look on the neirest point and then find wh...
AnandTiwari1997/ML-Algorithm-Scratch
KNN_Training_And_Prediction.py
KNN_Training_And_Prediction.py
py
3,885
python
en
code
0
github-code
90
22666195300
import argparse import datetime import os import shutil import subprocess import sys import tempfile import gdal import numpy as np from tdm.radar import utils gdal.UseExceptions() SpatialReference = gdal.osr.SpatialReference splitext = os.path.splitext strftime = datetime.datetime.strftime strptime = datetime.date...
tdm-project/tdm-tools
tools/check_raw_to_warped.py
check_raw_to_warped.py
py
2,293
python
en
code
0
github-code
90
26659484081
"""CM-563 Add full_name to users Revision ID: f67f1970ee20 Revises: 2163c84d2cc6 Create Date: 2021-05-03 22:20:30.103778 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mssql # revision identifiers, used by Alembic. revision = "f67f1970ee20" down_revision = "2163c84d2cc6" branch_la...
ClimateMind/climatemind-backend
migrations/versions/202105032220-f67f1970ee20_cm_563_add_full_name_to_users.py
202105032220-f67f1970ee20_cm_563_add_full_name_to_users.py
py
718
python
en
code
14
github-code
90
12285910400
""" i-ADHoRe Processing """ import glob import os import json import yaml import pickle from misc.string import check_folder_path, is_int def iadhore_family_to_dict(infile): """ Convert i-ADHoRe family to Python dictionary :param infile: i-ADHoRe family file :return: Python dictionary Gene ID -> Fam...
ihsanmuchsin/MoSyn
prep/iadhore.py
iadhore.py
py
8,586
python
en
code
0
github-code
90
37613965704
import datetime from typing import List, Dict import bs4 import re fmt = "%Y年%m月%d日" def _parse_fund(data: List[str]) -> Dict: return { "date": datetime.datetime.strptime(data[0], fmt).date(), "share_value": float(data[1]), "total_value": float(data[2]), } def _parse_index(data: Lis...
fx-kirin/yfjpscraper
yfjpscraper/parser.py
parser.py
py
4,026
python
en
code
2
github-code
90
34951304328
# -*- coding: utf-8 -*- """ Created on Thu Feb 6 21:19:13 2020 @author: aniru """ n=int(input()) k=0 t=0 for i in range(1,n+1): if n%2==0: t=n//2 else: t=(n//2)+1 for j in range(1,n+1): if j==t-i+1 or j==t+i-1 or i==t and j>1 and j<n or i>t and (j==1 or j==n): ...
Anirudh1905/PYTHON
A pattern.py
A pattern.py
py
415
python
en
code
0
github-code
90
28941744641
def ngramsout(gesseq): geslines = sorted({'-1 %s' % ges[0] for ges in gesseq if ges[0] != '<SIL>'}) geslines.extend(['-99 <s>', '-1 </s>']) with open('task.arpabo', 'w') as f: f.write('\\data\\\n') f.write('ngram 1=%d\n' % len(geslines)) f.write('\n\\1-grams:\n\n') f.write('\...
FredWe/touch_project
kaldi/touch-project/s5/local/prepare_dict.py
prepare_dict.py
py
1,916
python
en
code
0
github-code
90
18169360039
from itertools import accumulate N, K, *PC = map(int, open(0).read().split()) P, C = [0] + PC[:N], [0] + PC[N:] ans = float("-inf") for start in range(1, N + 1): path = [] cur = P[start] path = [C[start]] while cur != start: path.append(C[cur]) cur = P[cur] A = list(accumulate(pa...
Aasthaengg/IBMdataset
Python_codes/p02585/s302147023.py
s302147023.py
py
566
python
en
code
0
github-code
90
2425268779
import io import os import json import time import random import hashlib import chain import config import keyboa def creates_a_hash_of_the_winning_number(num): # Создает хеш salt = os.urandom(64).hex() data = f'{num} {salt}' return hashlib.md5(data.encode()).hexdigest(), salt, num def add_new_user(...
ZaViBiS/hotwax
func.py
func.py
py
6,629
python
en
code
0
github-code
90
19443362785
import os import sys rootpath = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))).replace("\\","/") print("DBTOOL: %s" % rootpath) syspath=sys.path sys.path=[] sys.path.append(rootpath) #指定搜索路径绝对目录 sys.path.extend([rootpath+i for i in os.listdir(rootpath) if i[0]!="."])#将工程目录下的一级目录添加到python搜...
LianjiaTech/sosotest
AutotestFramework/core/tools/DBTool.py
DBTool.py
py
8,233
python
en
code
489
github-code
90
17981062729
# -*- coding: utf-8 -*- import sys from collections import deque, defaultdict from math import sqrt, factorial, gcd # def input(): return sys.stdin.readline()[:-1] # warning not \n # def input(): return sys.stdin.buffer.readline().strip() # warning bytes # def input(): return sys.stdin.buffer.readline().decode('utf-8')...
Aasthaengg/IBMdataset
Python_codes/p03673/s086382115.py
s086382115.py
py
663
python
en
code
0
github-code
90
32057996662
# 3个要点 时间循环 + 回调(驱动生成器) + epoll(IO多路复用) # asyncio是Python用于解决异步IO编程的一整套解决方案 # Tornado,gevent,Twisted(Scrapy, django channels) # 使用asyncio # 使用协程,必须搭配 事件循环才能使用 import time import asyncio # 处理回调函数传参问题 from functools import partial async def get_url(url): print(f'start url:{url}') # time.sleep(2) # 在耗时操作中,需要...
xiaoweigege/Python_senior
chapter12/1. loop.py
1. loop.py
py
1,783
python
zh
code
1
github-code
90
70668810856
#!/usr/bin/env python3 import torch def make_embedder( architecture: str='GPT', training_style: str='CSM', in_dim: int=1024, embed_dim: int=768, num_hidden_layers: int=1, masking_rate: float=0.2, dropout: float=0.1, t_r_precision: float = 0.2, # in seconds max_t_r: float = 300, # ...
athms/learning-from-brains
src/embedder/make.py
make.py
py
4,842
python
en
code
50
github-code
90
18814521417
import pytz import dateutil.parser import datetime import re from utils import LXMLMixin from openstates.scrape import Scraper, Event from openstates.exceptions import EmptyScrape # http://mgaleg.maryland.gov/mgawebsite/Meetings/Day/0128202102282021?budget=show&cmte=allcommittees&updates=show&ys=2021rs class MDEven...
openstates/openstates-scrapers
scrapers/md/events.py
events.py
py
5,751
python
en
code
820
github-code
90
73626283495
#-*- coding: utf-8 -*- import scrapy from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor from douban_movie.items import DoubanMovieItem class AwesomeMovieSpider(scrapy.spiders.CrawlSpider): name = 'awesome-movie' allowed_domains = ['movie.douban.com'] start_urls = ['https://movi...
Yao-Phoenix/challenge
challenge20/douban_movie/douban_movie/spiders/awesome_movie.py
awesome_movie.py
py
1,168
python
en
code
0
github-code
90
22833545574
""" Configuration specific modules and functions """ import logging from es_client import Builder from es_client.helpers.schemacheck import SchemaCheck from es_client.helpers.utils import get_yaml, prune_nones from es_stats_zabbix.defaults.config import schema from es_stats_zabbix.defaults.settings import apis from es...
untergeek/es_stats_zabbix
es_stats_zabbix/helpers/config.py
config.py
py
5,472
python
en
code
11
github-code
90
17300960638
#-*-coding:utf-8-*- wierzchołki = int(input("podaj liczbę wierzchołków: ")) print("wierzchołki zostały ponumerowane od 0 do %s" %(wierzchołki-1)) macierz = {} for i in range(wierzchołki): macierz[i] = [] for k in range(wierzchołki): if i != k: if k in macierz.keys(): macierz...
JuliaHardy/graphs
grafy_1.py
grafy_1.py
py
962
python
pl
code
0
github-code
90
20905146452
import argparse import json import re import string from paddlenlp.metrics import BLEU def setup_args(): """Setup arguments.""" parser = argparse.ArgumentParser() parser.add_argument("--dataset", type=str, choices=["SMD", "CamRest", "MultiWOZ"], required=True) parser.add_argument("--pred_file", type=...
PaddlePaddle/Research
NLP/EMNLP2022-Q-TOD/evaluate.py
evaluate.py
py
8,283
python
en
code
1,671
github-code
90
23530212542
#!/usr/bin/env python3 import os import sys import glob import argparse import logging import coloredlogs import datetime import numpy as np from matplotlib import pyplot as plt import mne # Baseline to the average of the section from the start of the epoch to the event BASELINE = (None, 0.1) # Expected number of sam...
uwmadison-chm/paper-fin-lott-2020
mmn_grand_average.py
mmn_grand_average.py
py
4,769
python
en
code
0
github-code
90
18776051797
# This is the main file for reading CSV data and performing normalization operations import pandas as pd import csv import normalization_procedures import input_parser from sql_table_creator import generate_1nf, generate_2nf_3nf, generate_bcnf_4nf_5nf # Reading the input csv file and the dependencies text file ...
hemanthmandava2181/Database-Project
main.py
main.py
py
5,794
python
en
code
0
github-code
90
72481009576
class IPPowerError(Exception): pass class IPPowerValueError(IPPowerError): def get_bad_value(self): try: return self._bad_value except AttributeError: return None def set_bad_value(self, bad_value): self._bad_value = bad_value return self class IP...
ethernetlord/ippower
libippower.py
libippower.py
py
6,178
python
en
code
0
github-code
90
13393792278
from model import * from config import * import torch.optim as optim from collections import OrderedDict def load(path): state_dict = torch.load(path) state_dict_rename = OrderedDict() for k, v in state_dict.items(): name = k[7:] # remove `module.` state_dict_rename[name] = v #print(s...
zhuxinang/MLMSNet
train.py
train.py
py
7,698
python
en
code
2
github-code
90
16046215665
# -*- encoding=utf-8 -*- BLACK = (0, 0, 0) WHITE = (255, 255, 255) SCREEN_SIZE = [160, 200] BAR_SIZE = [30, 3] BALL_SIZE = [9, 9] # 神经网络的输出 MOVE_STAY = [1, 0, 0] MOVE_LEFT = [0, 1, 0] MOVE_RIGHT = [0, 0, 1] # learning_rate LEARNING_RATE = 0.99 # 更新梯度 INITIAL_EPSILON = 1.0 # 0.5 FINAL_EPSILON = 0.1 #...
lichengzhang2005/deeplearning-pygame-dqn
dqn/config.py
config.py
py
3,218
python
zh
code
0
github-code
90
18513419109
S = input() T = input() if len(S)==1: Flag = (S==T) else: Flag = False for X in range(0,len(S)): S = S[-1]+S[0:-1] if S==T: Flag = True break if Flag: print('Yes') else: print('No')
Aasthaengg/IBMdataset
Python_codes/p03293/s623637409.py
s623637409.py
py
241
python
en
code
0
github-code
90
18288666919
import collections, copy h, w = map(int, input().split()) maze = [] maze.append("#" * (w + 2)) for i in range(h): maze.append("#" + input() + "#") maze.append("#" * (w + 2)) dis = [] for i in range(h + 2): temp = [-1] * (w + 2) dis.append(temp) def search(x, y): dis2 = copy.deepcopy(dis) move = [[...
Aasthaengg/IBMdataset
Python_codes/p02803/s121796436.py
s121796436.py
py
1,001
python
en
code
0
github-code
90
9114349135
from os import walk, system from pprint import pprint c2 = input("What to look for ? : ") l = [] for a, b, c in walk("src/"): for c1 in c: if c1.endswith(".java"): with open(a + "/" + c1, "r") as f: for line in f.readlines(): if line.count(c2) > 0: ...
AtomicMaya/BikeGame
test.py
test.py
py
415
python
en
code
0
github-code
90
70591427497
from abc import ABC, abstractmethod from typing import Tuple import numpy as np import scipy.integrate class Pulse(ABC): def __init__( self, baud_rate: float = 10e9, num_symbols: float = 1e3, samples_per_symbol: float = 2**5, ): self.baud_rate = baud_rate self....
geeanlooca/PyNLIN
pynlin/pulses.py
pulses.py
py
2,021
python
en
code
3
github-code
90
13064565866
from datetime import datetime from django.http import HttpResponseRedirect from django.shortcuts import render from django.template.defaultfilters import slugify from wagtail.admin.utils import send_notification from .forms import BlogForm, CaseStudyForm, FlowJSONFileForm, ImageForm, MarketplaceEntryForm from .model...
rapidpro/rapidpro-community-portal
src/rapidpro_community_portal/apps/portal_pages/views.py
views.py
py
12,665
python
en
code
18
github-code
90
22814088730
######################################################################################################################################### #imports from tkinter import filedialog from tkinter import * from tkinter import messagebox import tkintermapview from PIL import ImageTk, Image import customtkinter impor...
LHM2/PCAP_Analysis_Tool
project.py
project.py
py
37,694
python
en
code
0
github-code
90
70211260137
import pprint import re import sys """ File takes a fasta files and a path and outputs each sequence in it's own file # python split_fasta.py [FILE] [PATH] """ print("Usage: > python split_fasta.py [FASTA FILE] [PATH]") header = "" seq = "" uniref_id = "" # pattern = re.compile("^>.+?\|(.+?)\|.+?\s") pattern...
DanBuchan/bin_tools
split_fasta.py
split_fasta.py
py
850
python
en
code
0
github-code
90
34049029755
hist_file="history_wrists" #nov 13 hist_wrist = load_file(hist_file) # manually random split dataset, users, activities, raw_files = hist_wrist['_1.mp4'] dataset2, users2, activities2, raw_files2 = hist_wrist['_2.mkv'] dataset3, users3, activities3, raw_files3 = hist_wrist['_3.mp4'] # create point cloud array pt...
sy2657/activity_recognition
topological/preprocess_and_fit_data.py
preprocess_and_fit_data.py
py
1,705
python
en
code
0
github-code
90
72495849578
from collections import deque from copy import copy import pytest class Solution: def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ if not word: return False for i, row in enumerate(board): ...
enanablancaynumeros/interview_exercises
string_exist_in_grid.py
string_exist_in_grid.py
py
1,616
python
en
code
0
github-code
90
2939144859
import asyncio from temporalio.client import ( Client, ScheduleActionStartWorkflow, ScheduleUpdate, ScheduleUpdateInput, ) async def main(): client = await Client.connect("localhost:7233") handle = client.get_schedule_handle( "workflow-schedule-id", ) async def update_schedul...
temporalio/samples-python
schedules/update_schedule.py
update_schedule.py
py
734
python
en
code
68
github-code
90
8620370984
#Nikhil Vemula #Feb 16 2016 #CS61002 Algorithm & Programming 1 #American flag in turtle.py import turtle #To use graphics #WIKIPEDIA INFO '''Hoist (width) of flag: A = 1.0 Fly (length) of flag: B = 1.9 Hoist (width) of Union: C = 0.5385 (7/13) Fly (length) of Union: D = 0.76 E = F = 0.054 G = H = 0.063 Di...
radam0/Python
CS61002 Labs/Lab04.py
Lab04.py
py
3,441
python
en
code
0
github-code
90
39304251409
#binary search is better than linear search when the list of elements are more. in case of binary search we must have the elements in sorted order def Bsearch(lst,n): l=0 u=len(lst)-1 while l<=u: mid=(l+u)//2 if lst[mid]==n: globals()['pos2']=mid return True ...
PADDA-YOGESHWAR/python2
1-2binarysearch.py
1-2binarysearch.py
py
598
python
en
code
0
github-code
90
3393060834
from unittest import TestCase from icm.modular_test import ProcessModule, Compose, DataInit, Loop class AppenderModule(ProcessModule): required_keys = ["array"] def run(self): self.array.append(len(self.array)) class EpochsLoop(Loop): required_keys = [{"hp": ["max_length"]}] def terminate...
Akhilez/reward_lab
curiosity/icm/test_modular.py
test_modular.py
py
937
python
en
code
2
github-code
90
43577001761
class StackOfPlates: def __init__(self, stack_size): self.stacks = [] self.stack_size = stack_size def push(self, value): # Added new stack if (len(self.stacks)-1)< self.index_of_push_able_stack(): self.stacks += [[]] self.stacks...
mostafijur-rahman299/cracking-coding-interview-solutions
Stack & Queue/stack-of-plates.py
stack-of-plates.py
py
1,590
python
en
code
0
github-code
90
13633640595
""" A specialized database class for Gaia-ESO Survey data releases. """ import logging import numpy as np from astropy.io import fits from astropy.table import Table import utils from db import Database logger = logging.getLogger("ges") class GESDatabase(Database): def __init__(self, *args, **kwargs): ...
andycasey/ges-idr5
code/gesdb.py
gesdb.py
py
10,196
python
en
code
0
github-code
90
73909413415
# Import import json import PySimpleGUI as sg import spotipy from spotipy.oauth2 import SpotifyOAuth # Main windows def windows_main(): # Windows to update all def windows_update_all(): """ TODO Add a "try" for create a "APP_CLIENT_ID.txt" and "APP_CLIENT_SECRET.txt" if is not valid ...
YDeltagon/ListoFy
main.py
main.py
py
7,271
python
en
code
0
github-code
90
18296548619
import sys def I(): return int(sys.stdin.readline().rstrip()) X = I() for i in range(X,1000000): for j in range(2,int(i**.5)+1): if i % j == 0: break else: print(i) break
Aasthaengg/IBMdataset
Python_codes/p02819/s869612331.py
s869612331.py
py
218
python
en
code
0
github-code
90
69897770856
import pandas as pd #import numpy as np import matplotlib.pyplot as plt dataset= pd.read_json('iris.json') dataset= dataset.drop(columns= 'species') X= dataset.iloc[:, :].values from sklearn.decomposition import PCA pca= PCA(n_components= 2) X= pca.fit_transform(X) #explained_variance= pca.explained_varian...
jeshugames2/Iris
iris.py
iris.py
py
1,140
python
en
code
0
github-code
90
73783290536
import yaml import geopy.distance from pyproj import Proj def load_yaml(filename): """ Load yaml into python dict Parameters ---------- filename: str absolute path of .yaml file Returns ------- YAML: dict Required file """ with open(file...
sephwalker321/Bellpedia
bellpedia/functions.py
functions.py
py
3,796
python
en
code
0
github-code
90
17983505249
n,m=map(int,input().split()) mod=10**9+7 nkai=1 mkai=1 for i in range(1,n+1): nkai*=(i%mod) nkai=(nkai%mod) for i in range(1,m+1): mkai*=(i%mod) mkai=(mkai%mod) if abs(n-m)>=2: print(0) elif abs(n-m)==1: print((mkai*nkai)%mod) elif abs(n-m)==0: print((mkai*nkai*2)%mod)
Aasthaengg/IBMdataset
Python_codes/p03681/s085979982.py
s085979982.py
py
283
python
ja
code
0
github-code
90
1691097915
from cmd import Cmd class MyPrompt(Cmd): def do_hello(self, args): """Says hello. If you provide a name, it will greet you with it.""" if len(args) == 0: name = 'stranger' else: name = args print("Hello, " + name) def do_quit(self, args): """Qui...
liyu10000/playboy
cases/qq/cmd_test.py
cmd_test.py
py
509
python
en
code
2
github-code
90
22139237672
import cv2 import numpy as np import matplotlib.pyplot as plt img = cv2.imread('C:/Users/TOBI/Documents/Belajar_Python/PCD_prak/p3/car.png') def img_to_hist(name, image): plt.figure(name) plt.title(name) plt.hist(image.ravel(), 256, [0,256]) # plt.savefig('{}.png'.format(name.lower())) return plt....
tobialbertino/belajar-code
Belajar_Python/PCD_prak/p3/lkp3test.py
lkp3test.py
py
2,212
python
en
code
2
github-code
90
29597822265
#!/usr/bin/python3 """ A module for working with lockboxes. """ def canUnlockAll(boxes): """Method that determines if all the boxes can be opened""" n = len(boxes) visited = [False] * n visited[0] = True pile = [0] while pile: actualBox = pile.pop() for key in boxes[actual...
8srael/alx-interview
0x01-lockboxes/0-lockboxes.py
0-lockboxes.py
py
469
python
en
code
0
github-code
90
19985427455
#!/usr/bin/env python3 from conans import ConanFile, CMake class AlloyConan(ConanFile): # Package Info name = "Alloy" version = "0.1.0" description = "A game engine" url = "https://github.com/bitwizeshift/Alloy" author = "Matthew Rodusek <matthew.rodusek@gmail.com>" license = "MIT" #...
bitwizeshift/Alloy
conanfile.py
conanfile.py
py
3,063
python
en
code
7
github-code
90
18296354939
X = int(input()) # 順に素数判定を行えばよい def is_prime(x): if x <= 1: return False for i in range(2, x): if x % i == 0: return False return True p = X while not is_prime(p): p += 1 print(p)
Aasthaengg/IBMdataset
Python_codes/p02819/s648379174.py
s648379174.py
py
233
python
en
code
0
github-code
90
34696601674
def even_list(s): s = s.split(' ') for word in s: if len(word) % 2 == 0: print(word) s = "bob jimmy baxb bernie bordan futurehendrix" even_list(s) test_str = "cob cimmy maxb bernie jordan cuturehendrix" res = [] for ele in test_str.split(): if len(ele) % 2: ...
solarphaces/PreWork
assignment_5.py
assignment_5.py
py
389
python
en
code
0
github-code
90
41089112217
import pygame from random import randint import time Xa=60 Ya=120 grid = [] class NoD(object): def __init__(self, x, y,Wal): self.x=x self.y=y self.gCost=0 self.hCost=0 self.Padre=None self.Ve=[] self.Wal=Wal def fCost(self): a=int(self.gCost+self.hCost) return a def Rve(): return self.Ve def...
Ilianx/Snake
Snake.py
Snake.py
py
9,829
python
en
code
0
github-code
90
26862245593
import time import asyncio from poke_env.player import Player, RandomPlayer from BattleNode import BattleTree ## Player object that utilizes a minimax algorithm + alpha beta pruning to attack class MinimaxABPlayer(Player): DEPTH = 3 def choose_move(self, battle): bt = BattleTree() bt.pop...
TrevorC64/poke-bot
Players/minimaxABPlayer.py
minimaxABPlayer.py
py
2,572
python
en
code
0
github-code
90
13474567519
import os import ckanapi from dotenv import load_dotenv load_dotenv() MY_API_KEY = os.getenv("API_KEY") ckan = ckanapi.RemoteCKAN('http://data.buspark.io', apikey=MY_API_KEY) packages = ckan.action.current_package_list_with_resources() for package in packages: print(f"Package Name: {package['name']}") print...
BU-Spark/infra-public-data-portal
ckan-scripts/traverse_site.py
traverse_site.py
py
523
python
en
code
4
github-code
90
23151447012
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' name: IIS WebDav info: "开启了WebDav且配置不当可导致攻击者直接上传webshell,进而导致服务器被入侵控制。 level: 紧急 type: 任意文件上传 repair: 禁用 IIS 的 WebDAV 服务 ''' import socket,urllib2,time from POC_Framework import POC class myPOC(POC): #单IP的POC def check(self, ip, port,...
JrDw0/POC-Framework
iis_webdav_put.py
iis_webdav_put.py
py
1,228
python
en
code
1
github-code
90
86705080912
from usefulFunctions import * """ The tag class contains different attributes: - Name: teh name of the tag. For example , the tag "<test att1="val1" att2="val2">something is written here</test>", would be "test". - Length: it is the length of the defining string. In the previous example, l...
quentinbragard/xmlToJson
tag.py
tag.py
py
5,882
python
en
code
0
github-code
90
18396890999
# 93 C - Switches N,M = map(int,input().split()) K = [] S = [] for _ in range(M): s = list(map(int,input().split())) K.append(s[0]) # 0-indexed s = [i-1 for i in s] S.append(s[1:]) P = list(map(int,input().split())) ans = 0 for i in range(1<<N): swiches = [0]*N for j in range(N): m...
Aasthaengg/IBMdataset
Python_codes/p03031/s215467600.py
s215467600.py
py
813
python
en
code
0
github-code
90
10434369793
import cv2 as cv import numpy as np import datetime import os import sys from csv import writer from parameters import \ model_path, scene_path, result_path, scene_compare_path from sklearn.ensemble import GradientBoostingRegressor from sklearn.model_selection import cross_val_score from skopt.space import Real, In...
MikeAlpaXRay/IFP_Hiwi
7_Surface Matching/Surface_Matching_Package/parameter_study_scikit.py
parameter_study_scikit.py
py
8,841
python
en
code
0
github-code
90
17978641729
n, p = map(int,input().split()) a=list(map(int, input().split())) odd=0 even=0 nCr = {} def cmb(n, r): if r == 0 or r == n: return 1 if r == 1: return n if (n,r) in nCr: return nCr[(n,r)] nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1) return nCr[(n,r)] for i in a: if i%2==0: even+=1 else: ...
Aasthaengg/IBMdataset
Python_codes/p03665/s070572627.py
s070572627.py
py
495
python
en
code
0
github-code
90
21317448055
class Morph: def __init__(self, dc): self.surface = dc['surface'] self.base = dc['base'] self.pos = dc['pos'] self.pos1 = dc['pos1'] class Chunk: def __init__(self, morph_list, dst): self.morph_list = morph_list self.dst = dst self.srcs = [] ...
KazumaAkiyama/100knocks
第5章/5-48.py
5-48.py
py
3,330
python
ja
code
0
github-code
90
9891724168
import logging from .ASWBXML import ASWBXML class ASCommandResponse: def __init__(self, response): self.wbxmlBody = response try: if ( len(response) > 0): self.xmlString = self.decodeWBXML(self.wbxmlBody) else: raise ValueError("Empty WBXML body passed") except Exception as e: self.xmlString...
wkeeling/selenium-wire
seleniumwire/thirdparty/mitmproxy/contrib/wbxml/ASCommandResponse.py
ASCommandResponse.py
py
1,089
python
en
code
1,689
github-code
90
32417770787
def insertionSort(list): for index in range(1, len(list)): currentvalue = list[index] position = index while position > 0 and list[position - 1] > currentvalue: list[position] = list[position - 1] position = position - 1 list[position] = currentvalue if __...
abu-sayem/Data-Structures-Algorithms-And-Databases
sorting/InsertionSort.py
InsertionSort.py
py
430
python
en
code
2
github-code
90
72201257898
# Medium # Your're given two linked lists of potentially unequal length. Each Linked List represents a non-negetive # integer, where each node in the Linked List is a digit of that integer, and the first node in each Linked # List always represents the least significant digit of the integer, Write a function that retu...
ArmanTursun/coding_questions
AlgoExpert/Linked Lists/Medium/Sum of Linked Lists/Sum of Linked Lists.py
Sum of Linked Lists.py
py
3,059
python
en
code
0
github-code
90
38091556447
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Gurobiモデルを作成するためのモジュール. Created on Sat Aug 14 23:35:25 2021 @author: y_hcr_manabe """ import os import zipfile import gurobipy as gp from .._make_dir import _make_dir from ._set_constraints import _set_constraints from ._set_object_function import _set_object_functi...
YamaLabTUS/ucgrb
ucgrb/make_grb_model/make_grb_model.py
make_grb_model.py
py
2,688
python
ja
code
2
github-code
90
20623051452
# defined function # tested validity of the function # called it three times def double(sequence): result = [] for element in sequence: result = result + [element * 5] return result double([7, 8, 9]) [35, 40, 45] double([5, 10, 15]) [25, 50, 75] double([3, 6, 9]) [15, 30, 45]
CompThinking19/exploratory-programming-1-tdg52
Exploratory1.py
Exploratory1.py
py
297
python
en
code
0
github-code
90
29855976115
import numpy as np import pandas as pd from matplotlib import pyplot as plt from matplotlib import colors from pyproj import Proj,transform from collections import Counter import pickle def longLatToXY(long, lat): """ converts epsg:4326 long lat (degrees) coordiantes to epsg:3857 xy coordiantes :param lo...
ChanaRoss/Thesis
UberData/preproc.py
preproc.py
py
3,501
python
en
code
0
github-code
90
4958288371
''' 218. The Skyline Problem Hard A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings as shown on a cityscape photo (Figure A), write a program to output the skyline formed ...
boxu0001/practice
py3/S218_skyline.py
S218_skyline.py
py
3,594
python
en
code
0
github-code
90
25926779350
import tqdm import copy import torch from utils.configs import config_parser from utils.common import create_usage from utils.ddpm import batch_diffusion, batch_inverse from utils.wandb_helper import LOG from utils.ema import EMA from dataset.data import POKEMON_DATASET if __name__ == "__main__": # NOTE Step: Prep...
jameskuma/Simple_Diffusion
run.py
run.py
py
2,544
python
en
code
0
github-code
90