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
25607998212
from __future__ import unicode_literals import youtube_dl import os from dl_link import downloadlinks from shutil import copyfile ydl_opts = { 'format': 'bestaudio/best', 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192', ...
adeel-q/Python-Youtube-Ripper
dl.py
dl.py
py
845
python
en
code
0
github-code
90
2461920111
class Solution(object): def divisorSubstrings(self, num, k): """ :type num: int :type k: int :rtype: int """ res = 0 str_num = str(num) for i in xrange(len(str_num)): sliced = str_num[i:i+k] if len(sliced) == k: ...
petrosDemetrakopoulos/Leetcode
code/Python/2269-FindTheK-BeautyOfANumber.py
2269-FindTheK-BeautyOfANumber.py
py
439
python
en
code
0
github-code
90
25043950782
from sqlalchemy import create_engine from sqlalchemy.orm import declarative_base, sessionmaker from app.config import settings engine = create_engine(settings.FMTM_DB_URL.unicode_string()) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) Base = declarative_base() FmtmMetadata = Base.metada...
hotosm/fmtm
src/backend/app/db/database.py
database.py
py
461
python
en
code
27
github-code
90
36425983844
from invenio.config import CFG_SITE_URL, CFG_WEBAUTHORPROFILE_USE_BIBAUTHORID from invenio.testutils import make_test_suite, run_test_suite, \ test_web_page_content, InvenioTestCase class WebAuthorProfilePageTest(InvenioTestCase): """Check /author profile pages.""" def test_author_page_klebanov(self): ...
aw-bib/tind-invenio
modules/webauthorprofile/lib/webauthorprofile_regression_tests.py
webauthorprofile_regression_tests.py
py
732
python
en
code
1
github-code
90
27902145720
import time import os # 1.需要备份的文件和目录将被 # 指定在一个列表中 source = ['/Users/learnlearn/PycharmProjects/pe/hw', '/Users/learnlearn/PycharmProjects/pc'] # 在这里注意到我们必须在字符串中使用双引号 # 用以括起其中包括空格的名称。 # 2.备份文件必须存储在一个 # 主备份目录中 target_dir = '/Users/learnlearn/Documents/Backup' # 3.备份文件将被打包压缩成zip文件 # 4.zip压缩文件的文件名由当前日期与时间构成 target = targ...
AUTHENTICGIT/PE
hw/backup_ver1.py
backup_ver1.py
py
877
python
zh
code
0
github-code
90
18438338434
############################################################ # Section 2: Grid Navigation ############################################################ # Returns a set of possible moves from the current position in the given # scene as a set of points def successors(node, scene): x = node[0] y = node[1]...
am-shashank/artificial-intelligence
GridNaviagation/GridNaviagation.py
GridNaviagation.py
py
2,839
python
en
code
1
github-code
90
6270491895
import uuid import webbrowser import requests from bs4 import BeautifulSoup import pandas as pd HTML_PAGES = "https://www.baseball-reference.com" FIRST_MOVE = 1953 LAST_MOVE = 1966 def pack_player(link, name, years): """ Pack player information into a diictionary Input: link: partial url of this p...
wusui/baseball_trivia
main.py
main.py
py
8,055
python
en
code
0
github-code
90
3674136174
from operator import itemgetter import cv2 import numpy as np cap = cv2.VideoCapture("result_moneta.mp4") draw = cv2.VideoCapture("assets\moneta.mp4") while True: topLCrn = [None, None] botRCrn = [None, None] ret, frame = cap.read() x, output = draw.read() if ret == True: indices = np.wh...
rombii/ObjDetection
tracker.py
tracker.py
py
1,066
python
en
code
0
github-code
90
34873345280
import numpy as np import pytest import pytz from pandas._libs.tslibs.tzconversion import tz_localize_to_utc class TestTZLocalizeToUTC: def test_tz_localize_to_utc_ambiguous_infer(self): # val is a timestamp that is ambiguous when localized to US/Eastern val = 1_320_541_200_000_000_000 va...
pandas-dev/pandas
pandas/tests/tslibs/test_tzconversion.py
test_tzconversion.py
py
953
python
en
code
40,398
github-code
90
14438765815
# encoding: utf-8 import re from pyquery import PyQuery from parser import Parser URL = 'https://fril.jp/search/{word}' class Rakuma(Parser): def do_search(self, word): res = self.get(URL.format(word=word)) doc = PyQuery(res.text) results = [] for item in doc(".item-list .item")...
hrdrq/price_search
parser/rakuma.py
rakuma.py
py
719
python
en
code
1
github-code
90
9219463575
import pausable_unittest import os import os.path import sys import shutil BASE_DIR = os.path.abspath(os.getcwd()) STARTUP_PATH = os.path.join(os.path.splitdrive(BASE_DIR)[0], "\\startup.nsh") TEMP_STARTUP_PATH = os.path.join(BASE_DIR, "startup.bak") SCRIPT_PATH = os.path.relpath(sys.argv[0]) STARTUP_CONTENT...
masamitsu-murase/pausable_unittest
pausable_unittest/efipauser.py
efipauser.py
py
2,239
python
en
code
5
github-code
90
70223069417
import numpy.fft as fft import numpy as np import matplotlib.pyplot as plt import itertools from statistics import mean, median import pandas as pd from sklearn.model_selection import train_test_split from sklearn import svm from sklearn import metrics import pickle import matplotlib.pyplot as plt ''' connection: blac...
LuwanW/sleep_lab_proj
modules/REM_analysis.py
REM_analysis.py
py
3,783
python
en
code
0
github-code
90
25788951663
import os import time from hedera import ( Hbar, AccountId, PrivateKey, Client, AccountBalanceQuery, TransferTransaction, ) from get_client import client, OPERATOR_ID recipientId = AccountId.fromString("0.0.3") amount = Hbar.fromTinybars(10_000_000) senderBalanceBefore = AccountBalanceQuer...
wensheng/hedera-sdk-py
examples/transfer_crypto.py
transfer_crypto.py
py
1,384
python
en
code
18
github-code
90
34038197276
'''Um programa que simule o jogo de adivinhação, em que o usuário deve tentar adivinhar um número escolhido pelo programa. O programa deve informar ao usuário se o número digitado é maior ou menor do que o número escolhido. O jogo deve continuar até que o usuário acerte o número escolhido. ''' import random print(...
dougfun/test
exercicio_28.py
exercicio_28.py
py
1,669
python
pt
code
0
github-code
90
70199733737
import numpy as np import sys import glob from astropy.io import fits import os from File_Display_Sorter import * cwd = os.getcwd() allfits = glob.glob('*.fits') for eachfile in allfits: header = fits.getheader(eachfile, ignore_missing_end=True, silentfix=True) objname = header['OBJECT'] if os.path.isdir...
kfollette/Follette-group
MinMs/mmt_file_sorter.py
mmt_file_sorter.py
py
1,482
python
en
code
2
github-code
90
13306956309
#!/usr/bin/env python3 # General idea: split up the birds in a *single* place # so that nothing can go wrong. import json # We have at most 4 columns, and for a 1280x1024 monitor you currently can # see three rows, so we need to load 4+4+1=9 birds initially, at least. INIT_DISPLAY_AMOUNT = 9 def strip_bird(bird, l...
Schwenger/House-Of-Tweets
pubweb/mk_json.py
mk_json.py
py
1,119
python
en
code
0
github-code
90
433205499
# Don't use anaconda for this import ctypes import os from PIL import Image, ImageOps import matplotlib.pyplot as plt import numpy as np class wrapper_hand_model(object): def __init__(self, lib_file='./utils/libPythonWrapper.so', model_file='./utils/hand2_l_all_uv.json'): self.lib = ctypes.cdll.LoadLibrar...
CMU-Perceptual-Computing-Lab/MonocularTotalCapture
POF/utils/wrapper_hand_model.py
wrapper_hand_model.py
py
7,110
python
en
code
646
github-code
90
19388823118
class ZeroTesting: def __init__(self, im, n): self.im = im self.n = n self.used = False def get_msg(self): using = "" if not self.used: using = " (used)" return "fo: " + str(abs(self.im)) + " - n: "
matifrancois/ITBA-Circuit_Theory
TP4_TC/AnalogFilterMaker/FrontEnd/UIs/Testing/ZeroTesting.py
ZeroTesting.py
py
267
python
en
code
0
github-code
90
17983642439
import math #import numpy as np import queue from collections import deque,defaultdict import heapq as hpq from sys import stdin,setrecursionlimit #from scipy.sparse.csgraph import dijkstra #from scipy.sparse import csr_matrix ipt = stdin.readline setrecursionlimit(10**7) def main(): n,m = map(int,ipt().split()) ...
Aasthaengg/IBMdataset
Python_codes/p03681/s269063277.py
s269063277.py
py
605
python
en
code
0
github-code
90
22291088244
##Soal untuk mahasiswa print("Soal untuk mahasiswa") print("==========================") print('') ## No1 print('No 1') def cetakSiku(x): for i in range(0, x): for j in range(0, i + 1): print('* ' , end='') print('') cetakSiku(5) ## No2 print("") print("==========================") pr...
olisuside/ASD
Prak 1/prak1.py
prak1.py
py
6,172
python
en
code
0
github-code
90
72201247658
# Medium # Given an array of distinct positive integers representing coin denominations and a single non-negative # integers n representing a target amount of money, write a function that returns the number of ways to # make change for that target amount using the given coin denominations. # Sample Input # n = 6 # de...
ArmanTursun/coding_questions
AlgoExpert/Dynamic Programming/Medium/Number of Ways To Make Change/Number of Ways To Make Change.py
Number of Ways To Make Change.py
py
1,014
python
en
code
0
github-code
90
23391849778
import numpy as np import sys def tdd(num): #three decimal display a = str((round(num*1000)/1000)) a =format(num, '.3f') return a def make_line(ix,iy,jx,jy): cov = np.cov([ix, jx],[iy, jy],bias=True) # orthogonal least squares val,ei = np.linalg.eig(cov) if(0==val[0]): ...
Yaciukdh/RandomPythonCode
compvis/assignment2/c.py
c.py
py
3,491
python
en
code
0
github-code
90
30554316257
#https://programmers.co.kr/learn/courses/30/lessons/17681 def solution(n, arr1, arr2): answer = [] for i, current in enumerate(arr1): b = arr2[i] res = bin(current | b) answer.append((res).replace('0b','').zfill(n).replace('1', '#').replace('0', ' ')) return answer #print(solution...
nagneo/programmers
secretMap/solution.py
solution.py
py
438
python
en
code
0
github-code
90
36188026296
def levenshtein(s, t): ''' From Wikipedia article; Iterative with two matrix rows. ''' if s == t: return 0 elif len(s) == 0: return len(t) elif len(t) == 0: return len(s) v0 = [None] * (len(t) + 1) v1 = [None] * (len(t) + 1) for i, __ in enumerate(v0): v0[i]...
clefourrier/CopperMT
pipeline/data/management/from_etymdb/utils/edit_distance.py
edit_distance.py
py
2,057
python
en
code
9
github-code
90
74749820457
"""main URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based vi...
yuburov/python_group_3_exam_7_yubur_aziz
source/main/urls.py
urls.py
py
1,784
python
en
code
0
github-code
90
33367725381
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from pcplot import * from matplotlib.offsetbox import AnchoredText def reconEval(label,Y_tilda,Y_til_recon,title): ###### visualize Y_tilda & Y_til_recon ########### Y_tilda_tran = pcplot(label,...
qwang435/Maximum-Covariance-Unfolding-Regression
reconComp.py
reconComp.py
py
2,515
python
en
code
1
github-code
90
27756840067
import tesults import sys import os from _pytest.runner import runtestprotocol # The data variable holds test results and tesults target information, at the end of test run it is uploaded to tesults for reporting. data = { 'target': 'token', 'results': { 'cases': [] } } # Converts pytest test outcome to a tesul...
wskariah/python_automation
conftest.py
conftest.py
py
3,000
python
en
code
0
github-code
90
41023056661
from django.conf.urls import patterns, include, url from sb import views from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', views.home), url(r'^show_write_form/$', views.show_write_form), url(r'^DoWriteBoard/$', views.DoWriteBoard), url(r'^viewWork/...
JOLP/SharingCode
django_board/dj_board/urls.py
urls.py
py
807
python
en
code
2
github-code
90
5887419832
from unityagents import UnityEnvironment from maddpg import MADDPG from ddpg import ReplayBuffer import numpy as np import torch import matplotlib.pyplot as plt from collections import deque env = UnityEnvironment(file_name = "Tennis.app") brain_name = env.brain_names[0] brain = env.brains[brain_name] agent = MAD...
biemann/Collaboration-and-Competition
test.py
test.py
py
1,497
python
en
code
0
github-code
90
71587082537
# Graph.py # 그래프 정점 클래스 class Vertex : # 그래프 정점 초기화 함수 def __init__(self, vertex) : self.name = vertex self.neighbors = [] # 그래프 인접리스트 삽입 함수 def insert_neighbor(self, neighbor) : if isinstance(neighbor, Vertex) : if neighbor.name not in self.neighbors : ...
alstn2468/python-data-structure
Graph/Graph.py
Graph.py
py
5,324
python
en
code
2
github-code
90
27097894978
from spack import * class YamlCpp(CMakePackage): """A YAML parser and emitter in C++""" homepage = "https://github.com/jbeder/yaml-cpp" url = "https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.5.3.tar.gz" git = "https://github.com/jbeder/yaml-cpp.git" version('develop', branch='mas...
matzke1/spack
var/spack/repos/builtin/packages/yaml-cpp/package.py
package.py
py
1,646
python
en
code
2
github-code
90
20856083617
### BaekJoon # https://www.acmicpc.net/problem/5597 nlist = [0]*30 while True: try: x = int(input()) nlist[x-1] = 1 except: break for i in range(len(nlist)): if nlist[i] == 0: print(i+1, end=' ')
skfkeh/algorithm_test
baekjoon/b_5597_WhoIsNotSubmit.py
b_5597_WhoIsNotSubmit.py
py
220
python
en
code
0
github-code
90
10675431453
import time import random file = open("time_r_dp.txt","w") file.truncate(0) def main(): val = random.sample(range(1,100), 50) val.sort() wt = random.sample(range(1,51), 50) wt.sort() # val = [3,4,5,15,16] # values # wt = [2,3,4,5,10] # weights n = len(wt) W = 100 # max...
ninjaco1/CS325-HW3
knapsack.py
knapsack.py
py
2,843
python
en
code
0
github-code
90
43734560441
import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['Microsoft JhengHei'] plt.rcParams['axes.unicode_minus']=False '''一、長攻、對角和攔中三個位置的得分方式有哪些不同?''' player=[] with open('tvl-ctvba-2017-2019-2.txt',encoding='utf8') as f: for line in f: player.append(line.split()) playerSet = ['長攻','對角'...
sarahting101/tvl
tvl.py
tvl.py
py
3,502
python
en
code
0
github-code
90
28441124954
user = { 'name': 'Golem', 'age': 5006, 'can_swim': False } for item in user: print('Only keys @ user->', item) for item in user.values(): print('Only values @ user.values()->', item) for item in user.keys(): print('Only keys @ user.keys()->', item) for key, value in user.items(): print...
BarSnir/ztm-course-python
section-2/loops_pt2_dict.py
loops_pt2_dict.py
py
513
python
en
code
0
github-code
90
32272973548
from HW02_1_2017135002 import myran import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import sympy as sp #미분 적분 하기 위하여 sympy 모듈 사용 from scipy import stats def mygauss(m,std,N): #난수 N/2개씩 생성하여 총 N개 생성 # float object cannot be interpreted as an integer 오류 발생 x1...
castleyun/Code
천문계산법/HW03_가우스정규분포/HW03_01_2017135002.py
HW03_01_2017135002.py
py
4,189
python
ko
code
0
github-code
90
12007476417
def cifradoVigenere(string1, key): """dic = {"a":0, "b":1, "c":2, "d":3, "e":4, "f":5, "g":6, "h":7, "i":8, "j":9, "k":10, "l":11, "m":12, ""}""" dicc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "ñ", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] st...
FJArribas/Cripto
back/Flujo.py
Flujo.py
py
882
python
la
code
0
github-code
90
18957546100
import sqlite3 connection = sqlite3.connect("gta.db") cursor = connection.cursor() # In charge of all our communication with out DB. # Create table of gta cities. cursor.execute("create table gta (release_year integer, release_name text, city text)") #text means string here release_list = [ (1997, "Grand Theft ...
mikio1998/sqlite-gta
gta cities/main.py
main.py
py
1,833
python
en
code
0
github-code
90
12847724815
from typing import Any, Optional from fastapi import Request, APIRouter, Depends from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from loguru import logger from core import deps from core.utils.reqparse import parse_item from core.utils.return_message import general_message fr...
wutong-paas/wutong-console
apis/manage/components/wutong_ports_controller.py
wutong_ports_controller.py
py
12,394
python
en
code
6
github-code
90
74540810855
import json import time import urllib.request from urllib.error import HTTPError import ssl from djangoWebCrawl.crawl.sql import mysql USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) ' \ 'Chrome/35.0.1916.47 Safari/537.36 ' def get_page(url, page, coll...
shopshipshake/Shopshipshake
djangoWebCrawl/crawl/stage_1/shopify.py
shopify.py
py
5,879
python
en
code
7
github-code
90
6803840887
from html2text import html2text import requests from bs4 import BeautifulSoup def extract(url): print('XakataMX extract {}'.format(url)) response = requests.get(url) soup = BeautifulSoup(response.text, 'html5lib') article = soup.find('article') image_parent = soup.find('div', {'class': ['article-a...
callback-demons/callback-news-collectors
sites/xakatamx.py
xakatamx.py
py
750
python
en
code
1
github-code
90
44884522069
import sys import os import shutil import numpy as np from tqdm import tqdm from tqdm.contrib.concurrent import process_map import matplotlib.pyplot as plt import PIL from PIL import Image import random from multiprocess import Pool def show_random_images(count=10): fig = plt.subplots(figsize=(18, count/2*5)) ...
simsta1/cnn-photographer-image-labelling
program/helper.py
helper.py
py
5,396
python
en
code
0
github-code
90
29952523054
print("Mary had a little lamb.") # prints out string and the end of the string has a placeholder using `{}` # we use `.format()` to fill in the place holder with 'snow' print("Its fleece was white as {}.".format('snow')) print("And everywhere that Mary went.") # prints out 10 periods because we've multiplied '.' by 10...
hdolinh/python-carpentries
learn-python-the-hard-way/ex7.py
ex7.py
py
973
python
en
code
0
github-code
90
33633322609
from django.shortcuts import render from rest_framework import viewsets from server import models from server import serializers class ProductViewSet(viewsets.ReadOnlyModelViewSet): queryset = models.Product.objects.all() serializer_class = serializers.Product def get_serializer_context(self): s...
reepoi/product-code-registry-temp
server/views.py
views.py
py
849
python
en
code
0
github-code
90
13896623222
""" Write a program to print the following: 1 2 3 4 5 6 7 8 9 """ n, r = map(int, input("Enter the size & row: ").split()) j = 1 i = 1 for i in range(1, n+1): print(f"{i} ", end=" ") if i % 3 == 0: print()
BalveerSinghYT/Python
Pattern/series_rows.py
series_rows.py
py
245
python
en
code
0
github-code
90
69969685096
from data import question_data from question_model import Question from quiz_brain import QuizBrain question_bank = [] for data in question_data: question_bank.append(Question(data["question"], data["correct_answer"])) quiz = QuizBrain(question_bank) should_continue = True while should_continue: ...
GokulBakkiyarasu/QuizGame
main.py
main.py
py
401
python
en
code
5
github-code
90
15923938952
"""Client side Python wrapped REST API.""" import logging import urllib.parse as up import requests class JSI: """Object providing Pythonic access to the HTTP RESTful API used by the backend server.""" __slots__ = ("_url", "_cert", "_verify", "_logger") def __init__(self, url, cert=None, verify=False): ...
alexanderrichards/ProductionSystem
productionsystem/api.py
api.py
py
9,684
python
en
code
0
github-code
90
73525568935
# -*- coding: utf-8 -*- """ Created on Mon Feb 18 15:37:37 2019 @author: rober """ import games EAGLE_NAME_DICT = {'Crosses the auto line (auto-run)':'cross_line', 'Number of Cubes in Exchange':'cube_vault', 'Number of cubes in auton':'auton_cube_count', 'Numb...
FRC830/scouting_data_viewer
games/powerup.py
powerup.py
py
3,650
python
en
code
0
github-code
90
18279795299
import math I = lambda: list(map(int, input().split())) n, d, a = I() l = [] for _ in range(n): x, y = I() l.append([x,y]) l.sort() j = 0 limit = [] for i in range(n): while l[j][0] - l[i][0] <= 2*d: j+=1 if j == n: break j-=1 limit.append(j) ans = 0 num=[0]*(n+1) cnt=0 for i in range(n): l[i][1]-=(ans-cnt...
Aasthaengg/IBMdataset
Python_codes/p02788/s135993100.py
s135993100.py
py
429
python
en
code
0
github-code
90
18694504443
""" 作者:Lucifer 日期:2023年04月08日 """ import os import PIL from PIL import Image import imagehash from scipy.stats import pearsonr, spearmanr, kendalltau import traceback import matplotlib.pyplot as plt import time import sys class ImageQueryError(Exception): """ 自定义ImageQuery类里出现的异常基类 """ ...
lucifer-lson/python-data-analysis
week7/week7-1.py
week7-1.py
py
9,751
python
en
code
0
github-code
90
22025144172
""" 공백으로 분리(split)하여 파이썬 내장함수를 사용하면 해결되는 간단한 문제 """ def solution(s): split_data = s.split(' ') # 공백을 기준으로 문자열을 나눔 # capitalize 함수 설명 # https://zetawiki.com/wiki/%ED%8C%8C%EC%9D%B4%EC%8D%AC_%EB%AC%B8%EC%9E%90%EC%97%B4_capitalize() for idx, string in enumerate(split_data): split_data[i...
KJH9612/coding_interview
programmers/level2/course_30_lessons_12951.py
course_30_lessons_12951.py
py
559
python
ko
code
0
github-code
90
43270772083
# -*- coding: utf-8 -*- from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * from qgis.gui import * import psycopg2, sys, os, csv, resources, qgis.utils from PyQt4.QtCore import QSettings from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * from qgis.gui import * import ...
desenv-1dl/carregaEstilos
main.py
main.py
py
4,548
python
en
code
0
github-code
90
18634692380
import pickle import os # from dataset import char _pad = '<pad>' unk = '<unk>' eos = '<eos>' sos = '<sos>' mask = '<mask>' _logits = '1234567890' _punctuation = '\'(),.:;?$*=!/"\&-#_ \n' _letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' symbols = [_pad, unk, eos, sos, mask] + list(_logits) + list(_le...
huanghonggit/Mask-Language-Model
dataset/vocab.py
vocab.py
py
2,840
python
en
code
63
github-code
90
38163656445
from typing import Callable, Dict, List, Optional, Sequence, Union from torch.autograd import Function from torch.onnx.symbolic_helper import parse_args from torch.onnx.symbolic_registry import _registry as pytorch_registry from torch.onnx.symbolic_registry import register_op from mmdeploy.utils import IR, Backend, g...
fengbingchun/PyTorch_Test
src/mmdeploy/mmdeploy/core/rewriters/symbolic_rewriter.py
symbolic_rewriter.py
py
5,874
python
en
code
14
github-code
90
25252697472
import os import re import sys def replace_line_f32(match): s, A, B, C, D = match.groups()[:5] return f"{s}%temp{A} = fmul float %{B}, %{C}\n{s}%{A} = fadd float %temp{A}, %{D}" def replace_line_f64(match): s, A, B, C, D = match.groups()[:5] return f"{s}%temp{A} = fmul double %{B}, %{C}\n{s}%{A} = fa...
EMJzero/COaT_Project
remove_fmuladd.py
remove_fmuladd.py
py
1,523
python
en
code
0
github-code
90
9954858463
from unittest import TestCase import scipy import numpy as np from numpy.testing import ( assert_, assert_equal, assert_array_almost_equal ) import theano import theano.tensor as T from theano.tensor.shared_randomstreams import RandomStreams from theano import function from theano.tests import unittest_tools as ut...
masa-su/Tars
Tars/tests/test_distribution_samples.py
test_distribution_samples.py
py
19,125
python
en
code
63
github-code
90
16431749003
#!/usr/bin/python3 import subprocess try: command = ["bluetoothctl", "devices"] device_list = ( subprocess.run(command, capture_output=True, text=True, check=True) .stdout[:-1] .split("\n") ) except subprocess.CalledProcessError: print("Running command '{command}' failed") dev...
JeromeSiljanUTA/dots
bspwm/scripts/bluetooth_connect.py
bluetooth_connect.py
py
1,166
python
en
code
1
github-code
90
10302764304
# https://www.acmicpc.net/problem/17182 import sys sys.setrecursionlimit(999999999) def floyd(): for mid in range(N): for start in range(N): for end in range(N): grid[start][end] = min(grid[start][end], grid[start][mid] + grid[mid][end]) def dfs(cur, dist, visited): if di...
kjh9267/BOJ_Python
Back Tracking/17182.py
17182.py
py
841
python
en
code
0
github-code
90
44662314619
import sys import codecs import re import shutil filename = sys.argv[1] #This is the folder containing texts text_path = re.sub(r"(.*\/)[^\/]*$", r"\g<1>", filename) #These are the starting lines of the comment section stoplist = ["ShareArticle","Updated:","MoreIn","SpecialCorrespondent","METRO PLUS","EDUCATION PLUS...
OsmanMutlu/htmltotextstuff_thehindu
deletecertainstr.py
deletecertainstr.py
py
1,850
python
en
code
0
github-code
90
38236679337
# To decode, we simply extract the given key from the image. from PIL import Image import pickle import zlib # Loading the encoded image this time im = Image.open('encoded.png') pix = im.load() size = im.size d = list(im.getdata()) array = bytearray() key = b'' # This is where you would put the key printed from the...
sphynxy/fun-small-projects
crypt/decode_test.py
decode_test.py
py
681
python
en
code
0
github-code
90
20708663392
import numpy as np from typing import List, Tuple from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt def regression_analysis(pairs: List[tuple], labels: List[str] = None): """ This is a function to do linear regression analysis. Input pairs: [(x_1, y_1, label_1=None), ..., (...
jiangqn/code_zoo
regression_analysis.py
regression_analysis.py
py
1,756
python
en
code
3
github-code
90
2937716551
# [ 백준 ] 10872번: 팩토리얼 def solution() -> None: answer: int = 1 for number in range(1, int(input())+1): answer *= number print(answer) if __name__ == "__main__": from io import StringIO from unittest.mock import patch solution() def test_example_case(input: list[str]) ...
0417taehyun/Algorithm
Baekjoon/Python/01_Bronze/10872.py
10872.py
py
875
python
en
code
2
github-code
90
17963631529
n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) H=0 W=0 i=0 while i<n-1: if a[i]==a[i+1]: if H==0: H=a[i] i+=2 else: W=a[i] break else: i+=1 print(H*W)
Aasthaengg/IBMdataset
Python_codes/p03625/s479256923.py
s479256923.py
py
252
python
en
code
0
github-code
90
15945329828
print('输入两个数') print('按下q退出程序') while True: first_number = input('\n请输入第一个数:') if first_number == 'q': break second_number = input('\n请输入第二个数:') try: answer = int(first_number) / int(second_number) except ZeroDivisionError: print('除数不能为零') else: print(answer)
MateriaMedicaCarol/spride-jqueryStudy
chu.py
chu.py
py
378
python
en
code
0
github-code
90
2439305199
bl_info = { "name": "Shape Key Mirror Additive Extras", "blender": (2, 80, 0), "category": "Object", } """ Adds two extra buttons to the Shape Key Specials Menu (shape key context menu) that are like "Mirror Shape Key" and "Mirror Shape Key (Topology)", but add the mirrored movement to the current...
Mysteryem/Miscellaneous
blender/scripts/ShapeKeyMirrorAdditive.py
ShapeKeyMirrorAdditive.py
py
4,035
python
en
code
0
github-code
90
31255755344
#py- Regex-Parsing.py #author: Tuan Anh Vu #https://www.hackerrank.com/challenges/introduction-to-regex import re for _ in range(int(input())): s = input() p = r"^[\+-]?\d*\.\d+$" m = re.match(p, s) print(bool(m)) #https://www.hackerrank.com/challenges/re-split regex_pattern = r"[,\.]" # Do not delete...
vuhatuananh/hackerrank
py-Regex-Parsing.py
py-Regex-Parsing.py
py
1,606
python
en
code
0
github-code
90
74529858537
"""Adapted from mrqa_official_eval.py, which was adapted fromt the SQuAD v1.1 official evaluation script. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import string import re from collections import Counter class MRQAEvaluator: @staticmethod ...
ocastel/exact-extract
src/evaluation/mrqa_eval.py
mrqa_eval.py
py
3,108
python
en
code
13
github-code
90
37994963927
# -*- coding: UTF-8 -*- import arcpy import sqlite3 import os import sys import shutil from contextlib import closing from tools._tempSqlite import _tempSqlite #ツール定義 class SpatiliteFillDoughnut(object): def __init__(self): self.label = _("Fill Doughnut") self.description = _("Cre a polygon that fills t...
MALORGIS/l100toolsForArcGIS
tools/SpatiliteFillDoughnut.py
SpatiliteFillDoughnut.py
py
4,311
python
en
code
6
github-code
90
18380557319
a,b,c,d = map(int,input().split()) def mul_count(v,w,n): if v % n == 0: s = v//n else: s = v//n + 1 e = w // n if s > e: return 0 else: return e - s + 1 def koyaku(x,y): big = max(x,y) small= min(x,y) amari = big % small if amari == 0: return small else: return koyaku(small...
Aasthaengg/IBMdataset
Python_codes/p02995/s982114240.py
s982114240.py
py
527
python
en
code
0
github-code
90
11884664466
from question_model import Question from data import question_data from quiz_brain import QuizBrain question_bank = [] for q_and_a in question_data: question_bank.append(Question(q_and_a['question'], q_and_a['correct_answer'].lower())) quiz = QuizBrain(question_bank) while quiz.still_has_questions(): quiz.ne...
hamidov9jat/Quiz-Game
main.py
main.py
py
473
python
en
code
0
github-code
90
34867551179
# -*- coding: utf-8 -*- # @Time : 2020-04-26 15:48 # @Author : zxl # @FileName: MLP.py import sys import random import numpy as np import tensorflow as tf from datetime import datetime class MLP: def __init__(self,learning_rate,batch_size,iteration): self.learning_rate=learning_rate self.bat...
Jane11111/Rec_proj2
MLP.py
MLP.py
py
3,931
python
en
code
0
github-code
90
36333192218
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/9/19 # @Author : JiaoJianglong import re import logging import random from abc import abstractmethod, ABCMeta from common_qa.analyze.tfidf import my_tfidf_model from models.es.rg_search_question import RGSearchQuestion from common_qa.analyze.q...
jiaojianglong/MyBot
chat_bot/common_qa/processor.py
processor.py
py
1,770
python
en
code
0
github-code
90
23256416193
from __future__ import absolute_import, print_function, unicode_literals import pytest from compat_patcher_core.utilities import ( PatchingUtilities, detuplify_software_version, tuplify_software_version, WarningsProxy, ) example_settings = { "logging_level": "INFO", "enable_warnings": True, ...
pakal/compat-patcher-core
tests/test_patching_utilities.py
test_patching_utilities.py
py
6,080
python
en
code
3
github-code
90
72223185256
# -*- coding: utf-8 -*- """ Created on Wed Nov 20 09:39:10 2019 @author: deesaw """ f=open('Setting.txt','r') settings = {} for line in f: line=line.strip() if not line.startswith('#') and len(line) > 0: key ,value = line.strip().split('=') settings[key.strip()] =value.strip() f.close() print(settings) print(...
deesaw/Vimpp
Python/asss5.py
asss5.py
py
352
python
en
code
0
github-code
90
10987377374
from __future__ import print_function, unicode_literals, division, absolute_import from future import standard_library standard_library.install_aliases() # noqa from builtins import * # noqa import os import re import json import requests from nlpia.constants import logging, DATA_PATH, BIGDATA_PATH from tqdm import...
Allensmile/nlpia
nlpia/data/loaders.py
loaders.py
py
15,004
python
en
code
null
github-code
90
17301845648
from turtle import Turtle, Screen def szu_1(x): x.color("black") x.pensize(10) x.right(90) return x.forward(200) def szu_2(x): x.color("black") x.pensize(10) x.right(90) x.forward(50) return x.backward(100) def szu_3(x): x.color("black") x.pensize(10) x.forward(50) ...
JuliaHardy/python_basics
hangman/draw.py
draw.py
py
1,551
python
en
code
0
github-code
90
18510963139
#!/usr/bin python3 # -*- coding: utf-8 -*- def main(): D, G = map(int, input().split()) P = [0] * D C = [0] * D for i in range(D): p, c = map(int,input().split()) P[i] = p C[i] = p * 100 * (i+1) + c ret = 1000 for i in range(2 ** D): pt = 0 ct = 0 ...
Aasthaengg/IBMdataset
Python_codes/p03290/s625518929.py
s625518929.py
py
718
python
en
code
0
github-code
90
11726602823
import pandas as pd import matplotlib.pyplot as plt data = pd.read_csv("timeTemp.txt", sep="\t") print(data.head()) print(data.describe()) z = data['°C'].mean() print(f"mean T: {z}") # histogram for °C column data.hist(column='°C') plt.show()
lurbano/DataAnalysis
filePandas.py
filePandas.py
py
250
python
en
code
0
github-code
90
36518199740
# pull all web scaper data here from ..companies.Amazon.scraper import Scraper as AmazonScraper from ..companies.Facebook.scraper import Scraper as FacebookScraper from ..companies.Google.scraper import Scraper as GoogleScraper from ..companies.Guidewire.scraper import Scraper as GuidewireScraper from ..companies.HubSp...
ConanKeaveney/JobHub-Scrapers
pytest/scrape.py
scrape.py
py
4,233
python
en
code
0
github-code
90
27700635290
import numpy as np import glob import os def sortKeyFunc(s): return int(os.path.basename(s).split('_')[0]) def handleMultiQueries(sim): images = list() file_list = glob.glob('./cropped_queries/*.jpg') file_list.sort(key=sortKeyFunc) # start from index 0 cnt = 0 f_list = list() for idx, f in enumerate(file...
cwingho/CS5187-Vision-and-Image-Assignment-1
source code/rank.py
rank.py
py
1,905
python
en
code
0
github-code
90
21946117346
# distutils: extra_compile_args = -fopenmp # distutils: extra_link_args = -fopenmp # USE : # python setup_Project.py build_ext --inplace from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy ext_modules = [ Extension("Sprites"...
yoyoberenguer/GameControllerTester
setup_project.py
setup_project.py
py
982
python
en
code
2
github-code
90
3092630957
import json from utils.common import get_value class VlanReader(): def __init__(self, input_dict={}) -> None: self.input_dict = input_dict self.result = [] def get_vlan_name(self, vlan_dict={}): return get_value(vlan_dict, ["state", "name"], "") def get_vlan_id(self, vlan_dict={})...
amlabdr/ip-service
ipcollect-microservice/net/readers/vlan_reader.py
vlan_reader.py
py
1,707
python
en
code
0
github-code
90
25787321524
# -*- coding: utf-8 -*- """ Created on Fri Jan 6 09:23:46 2017 @author: Lucie """ ########## Librairies utilisées import pandas as pd import numpy as np import matplotlib.pyplot as plt import pylab from sklearn.preprocessing import scale from sklearn.decomposition import PCA from mpl_toolkits.mplot3d...
OliviaJly/segmentation-multicanale
Analyses.py
Analyses.py
py
6,738
python
fr
code
0
github-code
90
18317654359
N, M, K = map(int, input().split()) chess = [input() for i in range(N)] ans = [[0 for i in range(M)] for j in range(N)] index = 0 def ok(r, h, t): for i in range(h, t+1): if ans[r][i] or chess[r][i] == '#': return False return True def color(r, h, t): for i in range(h, t+1): ...
Aasthaengg/IBMdataset
Python_codes/p02855/s019010544.py
s019010544.py
py
1,213
python
en
code
0
github-code
90
42009258919
import os import re from collections import deque from .fields import Sound, Category from .xml import CATEGORY, SOUND_IN_CAT # only work with this extensions AUDIO_EXTENSIONS = [ 'mp3', 'wav', 'm4a', 'ogg' ] # scan or not id3 tags from each file for grab artist and title SCAN_ID3 = False class DirectoryData...
cloudpassion/soundpad-directory-list
app/files.py
files.py
py
4,111
python
en
code
0
github-code
90
5338872421
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module is """ # imports from sdk.controller.builder.get_all_category_request_builder import \ GetAllCategoryRequestBuilder from sdk.controller.builder.get_all_types_request_builder import \ GetAllTypesRequestBuilder from sdk.controller.sender.http_sender ...
dmoz/lementpro_python_sdk
sdk/controller/category_controller.py
category_controller.py
py
1,141
python
en
code
0
github-code
90
43212958674
''' 邢不行 | 量化小讲堂系列文章 《抱团股会一直涨?无脑执行大小盘轮动策略,轻松跑赢指数5倍【附Python代码】》 https://mp.weixin.qq.com/s/hPjVbBKomfMhowc32jUwhA 获取更多量化文章,请联系邢不行个人微信:xbx3642 ''' import pandas as pd import numpy as np from function import * import matplotlib.pyplot as plt pd.set_option('expand_frame_repr', False) # 当列太多时不换行 pd.set_option('display.max...
siegjan6/coin2021
program/大小盘风格轮动/1_大小盘风格轮动.py
1_大小盘风格轮动.py
py
3,803
python
en
code
3
github-code
90
26965560507
import logging from biweeklybudget.ofxapi.remote import OfxApiRemote logger = logging.getLogger(__name__) def apiclient(api_url=None, ca_bundle=None, client_cert=None, client_key=None): if api_url is None: logger.info('Using OfxApiLocal direct database access') import atexit from biweekl...
jantman/biweeklybudget
biweeklybudget/ofxapi/__init__.py
__init__.py
py
721
python
en
code
87
github-code
90
4886634920
import helpers import numpy as np def main(): ''' ''' # train = helpers.readRatingsFromFile('../generators/ratings/no1.train') # test = helpers.readRatingsFromFile('../generators/ratings/no1.validate') # predictions = helpers.readRatingsFromFile('../generators/ratings/no1.predictions') # hlu ...
mcmhav/suchBazar
evaluation/hlu.py
hlu.py
py
1,792
python
en
code
0
github-code
90
18496646959
N = int(input()) W = [input() for _ in range(N)] used = [] first = W[0] used.append(first) for index in range(1, len(W)): if W[index][0] == W[index-1][-1] and W[index] not in used: used.append(W[index]) else: print("No") exit() print("Yes")
Aasthaengg/IBMdataset
Python_codes/p03261/s851996160.py
s851996160.py
py
275
python
en
code
0
github-code
90
4710455988
# -*- coding: utf-8 -*- import settings as settings import network as net import log as log import time import _thread def start(): """Start monitoring of the given nodes in a thread""" settings.monitorRunning = True _thread.start_new_thread(monitor,()) #monitor() log.add("Monitoring Started") def stop(): """S...
hcbd/simple-lanmap
monitor.py
monitor.py
py
908
python
en
code
1
github-code
90
6014266700
from copy import deepcopy def rotate_stick(stick, table): stick_model = stick.model.stick_model erase_stick(stick, table) stick_model.rotation_index = stick_model.next_rotation_index() stick_model.shape = stick_model.rotations[stick_model.rotation_index] place_stick(stick, table) ...
Ditya4/tetris
control.py
control.py
py
12,591
python
en
code
0
github-code
90
3001827235
import random from django.http import HttpResponse from django.shortcuts import render # Create your views here. from wc_app2.models import Student def index(request): return HttpResponse("wc_app2index") def add_student(request): for i in range(100): student=Student() flag=random.randrange...
lindadarling/wordcount
wc_app2/views.py
views.py
py
1,115
python
en
code
0
github-code
90
42939189386
import socket import threading server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind(('127.0.0.1', 8989)) server.listen() print('Server is listening on 8989') clients = [] nicknames = [] def broadcast(msg): for c in clients: c.send(msg.encode('utf-8')) def handle(client): while T...
rishikant42/Python-TheHardWay
socket/revision/server.py
server.py
py
1,199
python
en
code
0
github-code
90
28349030120
import base64 import pickle import typing import sys import os import platform import requests import urllib.request from pathlib import Path from concurrent.futures import ProcessPoolExecutor import numpy as np import tqdm root_path = Path(__file__).resolve().parent.parent SUPPORTED_VERSIONS = ["3.8", "3.9", "3.10"]...
Gavin-Development/GavinBackend
GavinCore/load_data.py
load_data.py
py
10,773
python
en
code
7
github-code
90
10537499166
# -*- coding:utf8 -*- """深圳翰盛""" from result import Location, HeartBeat from datetime import datetime import logging from protocol import ProtocolTranslator class Longhan16m(ProtocolTranslator): """LH-16Smart(16M)""" @staticmethod def sum(s): a = "00" for i in range(0, len(s), 2): ...
sillyemperor/pygps
pygps/protocol/longhan.py
longhan.py
py
3,608
python
en
code
1
github-code
90
70858490858
''' Created on Dec 2, 2013 @author: daniel ''' # http://python-future.org/compatible_idioms.html from __future__ import print_function from builtins import input class PharmacyUI(object): def __init__(self, pController): self.__pController = pController self.__commands = { "0": self._...
vampy/university
fundamentals-of-programming/exam/exam-partial/src/ui/ui.py
ui.py
py
2,556
python
en
code
4
github-code
90
14572921347
def heapify(a,n,i): largest=i left=2*i+1 right=2*i+2 if(left<n and a[largest]<a[left]): largest=left if(right<n and a[largest]<a[right]): largest=right if(largest!=i): a[i],a[largest]=a[largest],a[i] heapify(a,n,largest) def heap_sort(arr): n=len(a)...
sayahna22/sayahna
22.7.2020/Heapsort .py
Heapsort .py
py
757
python
en
code
0
github-code
90
73517151977
my_dict = {1: 'winter', 2: 'winter', 3: 'spring', 4: 'spring', 5: 'spring', 6: 'summer', 7: 'summer', 8: 'summer', 9: 'autumn', 10: 'autumn', 11: 'autumn', 12: 'winter'} print(my_dict) your_season = input('Введите месяц в виде целого числа от 1 до 12_') print(my_dict.get(int(your_season))) my_list = ['winte...
amensh07/start_python-
hw-2.3.py
hw-2.3.py
py
615
python
ru
code
0
github-code
90
32631381001
#!/usr/bin/env python3 from tkinter import * from tkinter import messagebox window = Tk() window.geometry("200x200+20+50") window.title("My First GUI") def hello_call_back(): msg = messagebox.showinfo("Hello Python", "Hellp World") B = Button(window, text="Hello", command=hello_call_back) B.place(x=50, y=50)...
dmr-git/py
getprogramming/tk_test.py
tk_test.py
py
340
python
en
code
0
github-code
90