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
5033653307
from django.test import TestCase from django.contrib.auth.models import User from django.conf import settings from unittest.mock import Mock, patch from unittest import mock from twilio.rest import Client from help.models import Group, Event, UserProfile from help.forms import RegisterForm, UserForm, GroupForm, Contact...
davidbarat/P13
needhelp/help/tests/test_forms_models.py
test_forms_models.py
py
3,779
python
en
code
0
github-code
6
23474940192
from random import randint x=randint(0,9) tentative=3 while int(tentative) > int(x): y=input("saisir la réponse") if int(y)==int(x): print("bravo, vous avez gagné")
Doumachelsea/Monprojetpython
troisessais.py
troisessais.py
py
183
python
fr
code
0
github-code
6
1883937681
# -*- coding: utf-8 -*- """ Created on Thu Jun 10 21:31:20 2021 @author: Scott """ # %% Set up import pandas as pd import numpy as np import os import glob import matplotlib.pyplot as plt from matplotlib.lines import Line2D # import plotly.graph_objects as go from matplotlib.collections import PatchCollection from mat...
sckilcoyne/Election_Results
cambridge.py
cambridge.py
py
8,768
python
en
code
0
github-code
6
22423126020
import streamlit as st import pandas as pd import numpy as np import pickle import librosa import csv import os from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import LabelEncoder #from audio_recorder_streamlit import audio_recorder # def predict_age(audio_bytes): # input = librosa.cor...
DirectorOfUnskillful/Music_Genre_Classification
app1.py
app1.py
py
7,405
python
en
code
0
github-code
6
32741269203
import matplotlib.pyplot as plt import numpy as np def main(): edges = np.array([ (0, 1), (0, 5), (1, 2), (2, 6), (3, 7), (3, 8), (3, 11), (4, 0), (5, 2), (5, 4), (5, 6), (5, 10), (8, 7), (8, 12), (9, 10), (10, 11), (12, 11), ]) recursive_split(edges) def recursive_split(edges, level=0)...
snsinfu/bit5
test400-graph_split/main.py
main.py
py
2,038
python
en
code
0
github-code
6
3935444552
import argparse import sys import time from datetime import datetime, timedelta from glados.es.ws2es.es_util import ESUtil, num_shards_by_num_rows, DefaultMappings, CURRENT_ES_VERSION import glados.es.ws2es.signal_handler as signal_handler import glados.es.ws2es.resources_description as resources_description import gla...
chembl/chembl_ws_2_es
src/glados/es/ws2es/cluster_replication/cluster_replicator.py
cluster_replicator.py
py
13,233
python
en
code
1
github-code
6
5480416527
import os import requests from bs4 import BeautifulSoup import re import sys import getopt user_agent = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36' def get_music_data(url): """ 用于获取歌曲列表中的歌曲信息 """ headers = {'User-Agent':user_agent}...
haochen1204/Reptile_WYYmusic
pachong.py
pachong.py
py
3,850
python
en
code
1
github-code
6
24463956390
import numpy as np import pandas as pd import seaborn as sns #soru 1 df = pd.read_csv("persona.csv") df.head() df.describe() #soru 2 df["SOURCE"].nunique() #soru 3 df["PRICE"].nunique() #Soru 4 df["PRICE"].value_counts() #soru 5 df["COUNTRY"].value_counts() #soru 6 df.groupby("COUNTRY")["PRICE"].sum() #soru7 df.gro...
FatihKemalTerzi/Woking-on-Datasets
Kural_tabanli_siniflandirma_project.py
Kural_tabanli_siniflandirma_project.py
py
1,411
python
en
code
0
github-code
6
71483194428
import pyautogui as pgui import time # pgui.PAUSE = 2.5 pgui.FAILSAFE = True # positional variables // TO BE CHANGED IF REUSED, using mouse_pos.py export_position = 1250, 540 tab_delimited_file_position = 1304, 785 records_from_button_position = 1092, 724 records_from_button_position_first_box = 1207, 724 records_fro...
KnuxV/projet_transdisciplinaire
auto_clicker.py
auto_clicker.py
py
2,612
python
en
code
0
github-code
6
37107943507
"""1 question 1 sprint""" def kthTerm(n, k) -> int: """ n1, n1+n0, n2, n2+n0, n2+n1, n2+n1+n0, n3, n3+n0, n3+n1, n3+n1+n0, n3+n2, n3+n2+n1, n3+n2+n1+n0] """ res = [] for i in range(k): if len(res) > k: break res_copy = list(res) res.append(n**i) ...
Misha86/python-online-marathon
1_sprint/1_Question.py
1_Question.py
py
466
python
en
code
0
github-code
6
37307665313
import tkinter as tk from tkinter import ttk import serial from time import sleep # Configure the serial port settings port = "/dev/ttyS0" baudrate = 9600 # Open the serial port ser = serial.Serial(port, baudrate) def on_FOTA_selected(): data=4 ser.write(bytes([data])) ser.flush() received=...
nadinfromc137/AutoSync-ACCwithFOTA
GUI/gui.py
gui.py
py
3,626
python
en
code
1
github-code
6
18777180614
import base64 from io import BytesIO from flask import request # Get a Float parameter with name `name` from the request or # return the specified default value if it's absent def num(name, default=0): val = request.args.get(name) return float(float(val) if val is not None else default) # Get an...
Hitonoriol/MOND-PI
lab-10-endpoints/io_utils.py
io_utils.py
py
2,196
python
en
code
0
github-code
6
74577178748
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('rest', '0001_initial'), ] operations = [ migrations.CreateModel( name='ImageLike', fields=[ ...
ayyoobimani/Cloth-server
hiCloth/hicloth/rest/migrations/0002_imagelike_tag_userimageaction_usertaglike.py
0002_imagelike_tag_userimageaction_usertaglike.py
py
2,196
python
en
code
0
github-code
6
22676201180
import mxnet as mx import numpy as np import importlib import os import pickle from sklearn import preprocessing from rmacRegions import rmac_regions if __name__ == '__main__': featureDim = { 'vgg16': 512, 'resnet18': 512, 'resnet101': 512, 'resnet152': 512, 'custom': 512 ...
juvu/ImageSearch
utils/genDatabase_RMAC.py
genDatabase_RMAC.py
py
2,141
python
en
code
null
github-code
6
70490334907
""" Converting adjacency matrix to adjacency list """ # python3 converter.py def sortThird(val): return val[2] def main(): row1 = list(input("Row 1: ")) row2 = list(input("Row 2: ")) row3 = list(input("Row 3: ")) row4 = list(input("Row 4: ")) vlist = list(input("Vertices: ")) allRows = []...
locua/algorithms-learning
completed-labs/14/quiz/mattolist.py
mattolist.py
py
1,134
python
en
code
2
github-code
6
73554526269
from hw_asr.base import BaseModel import math import torch import torch.nn as nn import torch.nn.functional as F class MaskConv(nn.Module): def __init__(self, seq_module): super(MaskConv, self).__init__() self.seq_module = seq_module def forward(self, x, lengths): for module in self...
ArseniyBolotin/asr_project
hw_asr/model/deepspeech.py
deepspeech.py
py
4,068
python
en
code
0
github-code
6
811875796
# Substring with Concatenation of All Words - https://leetcode.com/problems/substring-with-concatenation-of-all-words/ '''You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and...
Saima-Chaity/Leetcode
Sliding_Window/SubstringWithConcatenationOfAllWords.py
SubstringWithConcatenationOfAllWords.py
py
1,493
python
en
code
0
github-code
6
20544187876
from taskManager.plotting import * import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "--log_path", type=str, required=True, help="Input TSV file path containing the output of ResourceMonitor" ) parser.add_argument( ...
rlorigro/TaskManager
bin/plot_resource_usage.py
plot_resource_usage.py
py
630
python
en
code
4
github-code
6
30815309971
from typing import List, Tuple import cmath import random _inv_root2 = 1 / cmath.sqrt(2) _root2 = cmath.sqrt(2) bra = List[complex] ket = List[complex] def vdot(v1, v2): return sum(v1[i] * v2[i] for i in range(len(v1))) def vinv(v): return [-x for x in v] def qdot(q1: ket, q2: ket) -> complex: return...
Wroppy/werry_math
physics/quantum/systems.py
systems.py
py
3,990
python
en
code
0
github-code
6
7796630315
import ZSI; from ZSIPatch import Struct class GetStatus_Dec(Struct): schema = 'http://opcfoundation.org/webservices/XMLDA/1.0/' literal = 'GetStatus' def __init__(self, name=None, ns=None, **kw): name = name or self.__class__.literal ns = ns or self.__class__.schema self._LocaleID = None; self._ClientReq...
BackupTheBerlios/pplt-svn
PPLT/Modules/Core/Server/OPCXML/OPCTypes/GetStatus.py
GetStatus.py
py
1,073
python
en
code
0
github-code
6
32603947460
from django.db import models from simple_history.models import HistoricalRecords from base.models.base import AuthBaseEntity from base.models.inventory import Inventory class Promotion(AuthBaseEntity): class Meta: ordering = ['-modified', '-created'] inventory = models.ForeignKey(Inventory, on_del...
SainezKimutai/test-capital
base/models/promotion.py
promotion.py
py
678
python
en
code
0
github-code
6
28990015892
from sys import platform, version_info if True: from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QTimer from PyQt5.QtGui import QFontMetrics from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox else: from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer from PyQt4.QtGui import QFo...
falkTX/Cadence
src/jacksettings.py
jacksettings.py
py
41,004
python
en
code
361
github-code
6
44724952954
# !/usr/bin/python """Main File to embedd and SRT or ASS subtitle file into an MKV file.""" import os import sys from os.path import basename from mkv import mkv import argparse import time def initParser(): parser = argparse.ArgumentParser() parser.add_argument("inputMkv", type=argparse.FileType('r'), ...
voelkerb/matroskaPlotter
bakeSub.py
bakeSub.py
py
1,360
python
en
code
0
github-code
6
36644827726
def log(message: str): with open('progress.log', 'a') as f: f.write(message+'\n') def log_broken_file(e, broken_filename: str): with open('broken_files.log', 'a') as f: f.write(broken_filename+'\n') f.write(str(e)+'\n') import os import json # import sys import random from datetime im...
AdrienSF/twitter-analysis
older/save_trained_lda.py
save_trained_lda.py
py
3,790
python
en
code
0
github-code
6
7005065421
import logging import logging.config from huggingface_hub import HfApi from typing import Text, Optional from .config_parser import ConfigParser from .exceptions import TaskModelMismatchException logging_config_parser = ConfigParser('config/logging.yaml') logging.config.dictConfig(logging_config_parser.get_config_dic...
MinuraPunchihewa/hugging-py-face
hugging_py_face/base_api.py
base_api.py
py
1,024
python
en
code
1
github-code
6
37276060555
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from torch.nn.modules.utils import _pair, _quadruple import math class MedianPool2d(nn.Module): """ Median pool (usable as median filter when stride=1) module. Args: kernel_size: size of pooling kernel, int or 2...
yeongjoonJu/CFR-GAN
tools/ops.py
ops.py
py
9,407
python
en
code
74
github-code
6
31482179843
from tkinter import * from tkinter import messagebox window = Tk() window.geometry("500x400") window.title("Medical Records") frame = Frame(window) #The layout of The Sick Class illness_ID = Label(window, text = "Illness Code") illness_ID.pack(side = LEFT) illness_ID.place(x = 20, y = 20) illness_entry = Entry(wi...
m-kona/medical-records
medical-records.py
medical-records.py
py
3,509
python
en
code
0
github-code
6
189554987
import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart with open('/home/ubuntu/environment/huntsman_scholar_final_proj/results.txt','r') as f: content = f.readlines() contents = ''.join(content) s = smtplib.SMTP('smtp.gmail.com', 587) # start TLS for security s.startt...
lawilding/huntsman_scholar_final_proj
sendEmail.py
sendEmail.py
py
736
python
en
code
0
github-code
6
12477052664
from cProfile import label from multiprocessing.sharedctypes import Value from re import T from typing import Dict, List, Optional, Tuple import torch import matplotlib.pyplot as plt import matplotlib.ticker as mticker import transformers import numpy as np import random import argparse from collections import default...
mariopenglee/llm-metalearning
src/submission/icl.py
icl.py
py
11,435
python
en
code
0
github-code
6
5290534852
# This file is part of Channel Capacity Estimator, # licenced under GNU GPL 3 (see file License.txt). # Homepage: http://pmbm.ippt.pan.pl/software/cce from collections import Counter import numpy as np import tensorflow.compat.v1 as tf tf.disable_v2_behavior() def weight_optimizer(neighb_count, labels) -> (float, l...
pawel-czyz/channel-capacity-estimator
cce/optimization.py
optimization.py
py
2,289
python
en
code
6
github-code
6
74175180349
# -*- coding:utf-8 -*- """ 题目描述:请实现两个函数,分别用来序列化和反序列化二叉树 解题思路: 序列化二叉树:把一棵二叉树按照某种遍历方式的结果以某种格式保存为字符串。需要注意 的是,序列化二叉树的过程中,如果遇到空节点,需要以某种符号(这里用#)表示。 序列化可以基于先序/中序/后序/按层等遍历方式进行,这里采用先序遍历的方式实现, 字符串之间用","隔开。 主要用递归思想,每次递归返回的是结点,递归中处理好结点终止的条件,并且递归 处理该节点的左右子结点 类中变量self.count记录每次调用递归时的结点在序列化中的位置 """...
xxxsssyyy/offer-Goal
61序列化二叉树.py
61序列化二叉树.py
py
1,469
python
zh
code
7
github-code
6
17079551201
from gensim.models import KeyedVectors from anki_corpus_for_gensim import bg_stopwords,en_stopwords import json, argparse, time from flask import Flask, request from flask_cors import CORS ################################################## # API part ################################################## app = Flask(__n...
teodorToshkov/sentencesimilarity
app.py
app.py
py
1,897
python
en
code
0
github-code
6
5264982546
#!<path_from_which_python_command> import sys import os from datetime import date import datetime import pkgutil import os import shutil import subprocess import time import urllib.request # To download files from tkinter import Tk, ttk # Download bar import zipfile from pathlib import Path import urllib.request as req...
gomuG/ROMiner
gUtil.py
gUtil.py
py
10,668
python
en
code
1
github-code
6
12018146730
import mysql.connector config = { 'user': 'root', 'password': '', 'host': 'localhost', 'database': 'quotes_test' } tab = 'tereshkova_table' def init_connection(): return mysql.connector.connect(**config) def close_connection(con): con.close() def copy_all_in_table(con, row_list): curso...
arkuz/quotes_test
helpers/DB.py
DB.py
py
965
python
en
code
0
github-code
6
42174822199
PAYMENT = "💰 افزایش موجودی" BUY_NEW_SERVICE = "🛍 خرید سرویس" GET_TEST_SERVICE = "🎁 دریافت سرویس رایگان" MY_SERVICES = "💎 سرویس های من" PRICE_LIST = "💲تعرفه سرویس" MY_PROFILE = "👤 پروفایل من" HELP = "❔ راهنما" SUPPORT = "💭 پشتیبانی انلاین" EXIT = "🔙 خروج" CHANNEL = "عضویت در کانال" I_HAVE_SUBSCRIBED = " ✅ عضو شد...
eloravpn/EloraVPNManager
src/telegram/user/captions.py
captions.py
py
701
python
fa
code
15
github-code
6
21628349339
#!/usr/bin/python3 # this file contains the code to publish parsed messages to your system # currently there is only MQTT implemented, which can be configured in the central config import logging import paho.mqtt.publish #internal imports import config def is_interval_matched(dateTime): dateTime seconds = i...
aburgr/smartmeter-reader
publish.py
publish.py
py
1,793
python
en
code
14
github-code
6
19235406042
from dash import dcc, html, dash_table import config import sites import numpy as np import pandas as pd def call_layout(site_config): layout = html.Div([ html.Div(id='dash-header', children=[ html.H1(children=config.title), html.H3(children=dcc.M...
fenggroup/bike-traffic-plotly-dash
layouts.py
layouts.py
py
9,242
python
en
code
5
github-code
6
367509253
import streamlit as st import pandas as pd import random from stqdm import stqdm df_64 = pd.read_csv("juyok_DB.csv", encoding='UTF8') df_est = pd.read_csv("juyok_DB_est.csv", encoding='UTF8') # st.write(df_64) st.markdown("## **당신의 이름은 무엇인가요?**") name = st.text_input("이름: ") st.markdown("## **당신의 성별은 무엇인가요?**") s...
baemsu/juyok
app.py
app.py
py
3,094
python
en
code
0
github-code
6
3200668360
import rodMassParam as P import matplotlib.pyplot as plt from control import TransferFunction as tf import control as cnt import numpy as np import rodMassParam as P # ----------- noise specification -------- # attenuate noise above omega_n by gamma_n def add_spec_noise(gamma, omega, flag): w = np.logspace(np.log1...
mebach/me431
homework_template_folders/homework_template_folders/practice_final/python/loopshape_rodMass.py
loopshape_rodMass.py
py
6,465
python
en
code
0
github-code
6
37695958743
zvirata = ["pes", "kočka", "králík", "had"] zvirata.append("andulka") # Slovník ze seznamu, klíč je druhý znak ve slově a hodnota je slovo zvirata_dict = {} for zvire in zvirata: zvirata_dict[zvire[1]] = zvire # Seřazení klíčů keys = zvirata_dict.keys() sort_letters = sorted(keys) # Vytvoření nového seznamu dle ...
Pavucinap/PyLadies
ulohy_05/povinna_uloha_6_zviratka.py
povinna_uloha_6_zviratka.py
py
1,197
python
cs
code
0
github-code
6
29834178126
''' Hacer un programa que lea el nombre y precio de un producto, el programa repetira esta accion hasta que el usuario lo desee, al finalisar mostrara el total de productos, la sumatoria de los precios, el porcentaje de IVA respecto al total y el total a pagar ''' cantidadProductos = 0 precioTotal = 0.0 totalPagar = 0...
Developer2022004/TercerSemestre
Parcial_uno/practicaCinco.py
practicaCinco.py
py
978
python
es
code
0
github-code
6
37016357191
#!/usr/bin/env python3 from __future__ import print_function import ase.io import sys import numpy as np if len(sys.argv) != 3: sys.stderr.write("Usage: %s model.so model_params < input.xyz\n" % sys.argv[0]) sys.exit(1) at = ase.io.read(sys.stdin, format="extxyz") import fortranMCMDpy FORTRAN_model = sys.a...
libAtoms/pymatnest
test_fortran_model.py
test_fortran_model.py
py
1,204
python
en
code
26
github-code
6
17878868675
#### # Each team's file must define four tokens: # team_name: a string # strategy_name: a string # strategy_description: a string # move: A function that returns 'c' or 'b' #### #Idea: run your own historical simulation before you play against anyone. This will allow you to determine how your opponent ...
rpyle/IPD2022
maggin.py
maggin.py
py
1,493
python
en
code
0
github-code
6
73761204349
import numpy as np from constants.constants import UNI, EXTENDED from utils.progress_bar import progress_bar def create(img:np.array, UNICODE=EXTENDED) -> str: res = "" for i,line in enumerate(img): progress_bar(i/img.shape[0]) for pixel in line: res += UNICODE[int(sum(pixel)/768*le...
carlospuenteg/Image-to-Unicode
create_txt.py
create_txt.py
py
363
python
en
code
9
github-code
6
4548632854
# num = int(input()) if num % 2 != 0 and num >= 1 and num <= 100: foo = (num / 2)+1 count = [int(i) for i in range(num) if i % 2 != 0][::-1] rnum = num #print(count) for i in range(num): print(" "*int(i),end='') print(i+1,end="") if int(foo) == i+1: print("") ...
SheikhAnas23/DLithe_Python_Internship_Report
day6/assingnment 3/prob5.py
prob5.py
py
441
python
en
code
0
github-code
6
19052278908
''' binary search (이진탐색) : 반드시 정렬된 상태에서 시작해야한다. 로그실행시간을 보장한다. 용어 설명 target : 찾고자하는 값 data: 오름차순으로 정렬된 list start: data의 처음 값 인덱스 end: data의 마지막 값 인덱스 mid: start,end의 중간 인덱스 바이너리 서치 data중 target을 검색하여 index 값을 return 한다. 없으면 None을 return ''' # target = 찾고자하는값, data: list값 def binary_search(target,data): data.sort() ...
parkjunga/algorithm
binary_search.py
binary_search.py
py
1,134
python
ko
code
0
github-code
6
1919214297
from lxml import etree import requests import pymysql def getdel(): url = 'https://book.douban.com/top250' data = requests.get(url).text s=etree.HTML(data) file=s.xpath('//*[@id="content"]/div/div[1]/div/table/tr/td[2]/div[1]/a/@title') print(file) return fil...
cxzw/python--
16219111435/席子文爬虫作业/静态爬虫.py
静态爬虫.py
py
601
python
en
code
0
github-code
6
1822549193
#class without chaining ##********************************* ##class MyHashMap: ## def __init__(self): ## self.size = 10 ## self.arr = [None for i in range(self.size)] ## #print(self.arr) ## ## def put(self,key,val): ## hsh = self.gethash(key) ## self.arr[hsh] = val ##...
sushasru/LeetCodeCrunch
LeetCode_E_DesignHashMap.py
LeetCode_E_DesignHashMap.py
py
2,082
python
en
code
0
github-code
6
43371076004
import requests from bs4 import BeautifulSoup import os def get_book(url): response = requests.get(url) response.encoding = "utf-8" text = response.text soup = BeautifulSoup(text) div_show = soup.select("div.dirShow")[0] # print(div_show) dirs = div_show.select("li a") count = len(dir...
frebudd/python
book_spider.py
book_spider.py
py
1,460
python
en
code
2
github-code
6
38217350686
#!/usr/bin/env python3 import argparse import sys from typing import List, Union import uuid import capstone_gt import gtirb from gtirb_capstone.instructions import GtirbInstructionDecoder def lookup_sym(node: gtirb.Block) -> Union[str, None]: """ Find a symbol name that describes the node. """ for s...
GrammaTech/ddisasm
tests/check_gtirb.py
check_gtirb.py
py
16,220
python
en
code
581
github-code
6
34508588550
# https://www.geeksforgeeks.org/find-sum-modulo-k-first-n-natural-number/ def find_sum(N,K): ans = 0 # Counting the number of times # 1, 2, .., K-1, 0 sequence occurs. y = N / K # Finding the number of elements # left which are incomplete of # sequence Leads to Case 1 type. x = ...
ved93/deliberate-practice-challenges
code-everyday-challenge/n131_sum_of_modulo_k.py
n131_sum_of_modulo_k.py
py
661
python
en
code
0
github-code
6
37065823559
class myclass: #aclass def inherit(self): self.A=int(input("enter the A value:")) self.B=int(input("enter the B value:")) class Addtion(myclass): def add(self): self.inherit() c=self.A+self.B print("Addition value are",c) class multiplication(myclass): def mul(self): ...
duraipandiyan/inheritance_opps
hirarichrical inheritance.py
hirarichrical inheritance.py
py
599
python
en
code
0
github-code
6
22047012801
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import RangeSlider import pims def gui(input_img): # read in an image, usually np.array kind. This one will be a stack of images # Initialize the frame number to be zero, since array indexing frame = 0 img = input_img fig, axs = pl...
kzhang425/PyImgTracker
gui_plots.py
gui_plots.py
py
1,454
python
en
code
0
github-code
6
6841379030
import itertools from collections import OrderedDict import nltk from spellchecker import SpellChecker from nltk.corpus import wordnet as wn from ranker import Ranker #import utils """ search engine for spell checker """ # DO NOT MODIFY CLASS NAME class Searcher: # DO NOT MODIFY THIS SIGNATURE # You can change...
hallelhel/Search_Engine
searcher_4.py
searcher_4.py
py
4,158
python
en
code
0
github-code
6
71749352509
import random from kafka import KafkaProducer producer = KafkaProducer(bootstrap_servers='0.0.0.0:9092') num = random.randint(0, 10) num_bytes = bytes(str(num), encoding='utf-8') is_send = producer.send('test-topic', value=num_bytes, key=num_bytes) # Block for 'synchronous' sends try: record_metadata = is_send....
makseli/kafka-docker-python
producer.py
producer.py
py
639
python
en
code
0
github-code
6
22812799305
# -*- coding: utf-8 -*- """ Created on Fri Aug 24 10:30:26 2018 @author: Puneet Kumar """ x = input("enter the text : ") #x = 'defgh' k = x = input("enter the text : ") #x = 'defgh' k = ['q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m'] alph...
pappukr4444/M.Tech-Labs
subtitution.py
subtitution.py
py
915
python
en
code
1
github-code
6
15774686000
import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) _...
pranayprasad7001/rock-paper-scissors
rock-paper-scissors.py
rock-paper-scissors.py
py
991
python
en
code
0
github-code
6
34450081054
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.shortcuts import render from django.views.generic.base import View from django.http import JsonResponse from participa.settings import SEFAZ_API_URL from participa.auth_sefaz.views import ParticipaSefazRequest, BaseView from pa...
vctrferreira/hackathon-sefaz
participa/report/views.py
views.py
py
2,135
python
en
code
1
github-code
6
17598457644
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from PIL import Image def make_pages(page, item_list, page_size): paginator = Paginator(item_list, page_size) try: images = paginator.page(int(page)) except PageNotAnInteger: images = paginator.page(1) except EmptyPage: images = pag...
mr-shubhamsinghal/gallery-app
gallery/utils.py
utils.py
py
510
python
en
code
0
github-code
6
71798191227
class NegativeDigitError(ValueError): """Exception raised when digit is negative in power and square_root calculations""" def __init__(self, digit): self.digit = digit self.message = f'Digit "{digit}" has to be positive for powering or square rooting' super().__init__(self.message) ...
withaim/ithillel
exceptions.py
exceptions.py
py
3,907
python
en
code
0
github-code
6
18183301241
from django.shortcuts import render, redirect from django.views.generic.edit import CreateView, UpdateView, DeleteView from .models import Post, Comment from .forms import CommentForm, ContactForm # Create your views here. def home(request): return render(request, 'home.html') def about(request): return rend...
gollobc/Meridio-Full-Stack-App
meridio/main_app/views.py
views.py
py
1,500
python
en
code
0
github-code
6
21390773853
def oddHelper(s, k): """1 <= k <= n-2""" i = 1 N = min(k, len(s) - 1 - k) while i <= N: if s[k - i] != s[k + i]: break else: i += 1 return (1 + 2 * (i - 1), s[k - i + 1 : k + i]) def evenHelper(s, k): """1 <= i <= n-2""" if s[k] != s[k + 1]: r...
Howii/LeetCode
prob_0005-Longest_Palindromic_Substring.py
prob_0005-Longest_Palindromic_Substring.py
py
1,091
python
en
code
0
github-code
6
4142566592
import ast import networkx as nx import numpy as np from collections import defaultdict import json from tqdm import tqdm # nodes = [0, 1, 2, 3, 4] # graph = [[4, 3, 0.75], [4, 1, 0.81], [4, 2, 0.97], [4, 0, 0.52]] # page_rank_probs = defaultdict(float) # DG = nx.DiGraph() # DG.add_nodes_from(nodes) # DG.add_weighted_...
Gitsamshi/Nli-image-caption
playground.py
playground.py
py
8,056
python
en
code
3
github-code
6
833697082
import numpy as np import matplotlib.pyplot as plt n = 6 maxI = 10000000 eps = 1e-6 def f(x): return (0.5*np.reshape(x, (1, n))).dot(A).dot(np.reshape(x, (n, 1))) + b.dot(x) def grad(x): return np.reshape(A.dot(x), (1, n)) + b def H(x): return A def Hinv(x): return np.linalg.inv(A) A = np.random....
UIIf/Study
3course/Optimization/FirstLab/lab3.py
lab3.py
py
1,423
python
ru
code
0
github-code
6
42493202461
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 2 16:13:15 2019 @author: michal """ from IOtemp import readAuthors, readPublications from MKAR_flow import MKAR_FlowTheory from math import ceil import networkx as nx def checkN(workersList): N = 0 for w in workersList: N += w.ti...
chemiczny/pubMatch
pubMatch/fordFulkersonAproximation.py
fordFulkersonAproximation.py
py
3,927
python
en
code
0
github-code
6
29437968143
tabby_cat = "\tI'm tabbed in." #The variable tabby_cat strores the string with a tab\ persian_cat = "I'm split\non a line." #The variable persian_cat stores the string and creates a new line within the text backslash = "I'm\\a\\cat." #The Varibale backslash stores the string and backslashes within fat_cat = """" I'w...
ERICMUKONGE/TRY4
ex10.py
ex10.py
py
719
python
en
code
1
github-code
6
15393475408
# -*- coding:utf-8 -*- class Solution: # 返回[a,b] 其中ab是出现一次的两个数字 def FindNumsAppearOnce(self, array): # write code here resultEx = 0 for obj in array: resultEx ^= obj indexof1 = self.findFirstBit1(resultEx) num1,num2 = 0,0 for obj in array: ...
shakesVan/Playground
Nowcoder/56.py
56.py
py
717
python
en
code
0
github-code
6
7176590579
import secrets from eth_keys import ( keys, ) from eth_utils import ( int_to_big_endian, ) try: import factory except ImportError: raise ImportError( "The p2p.tools.factories module requires the `factory_boy` library." ) def _mk_private_key_bytes() -> bytes: return int_to_big_endian(...
ethereum/py-evm
eth/tools/factories/keys.py
keys.py
py
772
python
en
code
2,109
github-code
6
39915090383
import numpy as np import pandas as pd import math import requests, json, time from datetime import datetime class Processor: def __init__(self, history_length): self.history_length = history_length def fetchHistoricalDataForTicker(self, fsym, tsym, lim): df_cols = ['time', 'open', 'high', 'low', 'close', 'vo...
kwhuo68/rl-btc
processor.py
processor.py
py
1,365
python
en
code
3
github-code
6
31309035194
#!/usr/bin/env python # coding: utf-8 # In[ ]: #Library Imports from __future__ import print_function, division from keras.models import Sequential, Model from keras.layers.core import Dense from keras.layers.recurrent import LSTM, GRU, SimpleRNN from keras.layers import Input from keras.utils.data_utils import get_...
RenatoMAlves/context-aware-time-prediction
code/Context-LSTM/train_addittional_feats_py3.py
train_addittional_feats_py3.py
py
13,972
python
en
code
0
github-code
6
75113992506
from timeit import default_timer as timer target = 150 start = timer() file = open('input.txt') def permute(vals, target): if len(vals) <=1: if len(vals) == 1 and vals[0] == target: return [vals] return [] else: ret = [] vals = [] + vals while(len(vals) > 0): val = vals[0] vals.pop(0) if val ...
kmckenna525/advent-of-code
2015/day17/part1.py
part1.py
py
932
python
en
code
2
github-code
6
38756128140
""" Kubernetes server class implementation. """ from __future__ import absolute_import import os import logging import uuid from kubernetes import config from kubernetes import client as k8sclient from kubernetes.client.rest import ApiException from retry import retry from pytest_server_fixtures import CONFIG from .c...
man-group/pytest-plugins
pytest-server-fixtures/pytest_server_fixtures/serverclass/kubernetes.py
kubernetes.py
py
5,398
python
en
code
526
github-code
6
7722813982
from pacman.model.partitioned_graph.multi_cast_partitioned_edge import \ MultiCastPartitionedEdge from spynnaker.pyNN.models.abstract_models.abstract_filterable_edge import \ AbstractFilterableEdge class ProjectionPartitionedEdge(MultiCastPartitionedEdge, AbstractFilterableEdge...
ominux/sPyNNaker
spynnaker/pyNN/models/neural_projections/projection_partitioned_edge.py
projection_partitioned_edge.py
py
2,558
python
en
code
null
github-code
6
31672849616
''' from PyQt5 import QtCore, QtWidgets, QtGui from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtCore import QUrl xcept ImportError: print("PyQt5 is not installed") ''' from PySide2 import QtCore, QtWidgets, QtGui from PySide2.QtWebEngineWidgets import QWebEngineView from PySide2.QtCore import QUrl...
ArturW/Discovery
pydiscoveryt.py
pydiscoveryt.py
py
10,341
python
en
code
0
github-code
6
73051866108
import matplotlib.pyplot as plt import numpy as np import os import PIL import tensorflow as tf from tensorflow import keras model = tf.keras.models.load_model('C:/AI/model.h5') class_names = ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips'] img_height = 180 img_width = 180 sunflower_url = "http...
dasfef/PyQt5
Ex20221202_3(h5 activate).py
Ex20221202_3(h5 activate).py
py
925
python
en
code
0
github-code
6
16304234084
f = open("Data/URL.txt", "a") #inp=input("Enter the url\n") #inp+="\n" import sys print("Enter the data") data = sys.stdin.read() # Use Ctrl d to stop the input data=list(data) indices = [i for i, x in enumerate(data) if x == "\n"] j=0 inp=input("enter label\n") for i in indices: ted=i+j data.insert(ted,"\t"+inp)...
SK9712/Detecting-Malicious-Url-Using-Character-level-CNN
dataset_creator.py
dataset_creator.py
py
350
python
en
code
8
github-code
6
22049207954
# macros.py contains the SavedFiles class, which is used # to maintain a directory of files with saved macro inputs import os import player import record DEFAULT_LOG = "action_log.txt" class SavedFiles: DIRECTORY_NAME = "Macros" # name of directory to save files in files = ['' for x in range(...
Jedi123jet/Ekko
macros.py
macros.py
py
5,066
python
en
code
0
github-code
6
72531788029
# pylint: disable=redefined-outer-name # pylint: disable=unused-argument # pylint: disable=unused-variable # pylint: disable=too-many-arguments import pytest from models_library.api_schemas_webserver.projects import ( ProjectCreateNew, ProjectGet, ProjectListItem, ProjectReplace, TaskProjectGet, )...
ITISFoundation/osparc-simcore
packages/models-library/tests/test_api_schemas_webserver_projects.py
test_api_schemas_webserver_projects.py
py
2,403
python
en
code
35
github-code
6
14950042406
def add_task(todo_list): task = input("Enter the task: ") todo_list.append(task) print(f"Task '{task}' added to the to-do list.") def view_tasks(todo_list): if not todo_list: print("No tasks in the to-do list.") else: print("To-Do List:") for index, task in enumera...
SanjanaLakkimsetty/CodersCave
coderscave todo/todo_app.py
todo_app.py
py
1,497
python
en
code
0
github-code
6
26102744693
#!/usr/bin/python import os, sys # copied from: # https://github.com/rose/nand2tetris/blob/master/assembler.py # these three dictionaries store the translations of the 3 parts # of a c-instruction comp = { "0": "0101010", "1": "0111111", "-1": "0111010", "D": "0001100", "A": "0110000", "!D": "0...
philzook58/nand2coq
verilog/assembly.py
assembly.py
py
4,058
python
en
code
49
github-code
6
21666324114
#https://leetcode.com/problems/3sum/ from collections import defaultdict class Solution: #Fast and extremely clever solution, need to study this further to understand how it works def threeSum(self, nums: list[int]) -> list[list[int]]: negative = defaultdict(int) positive = defaultdict(int) ...
Adam-1776/Practice
DSA/3sum/solution.py
solution.py
py
2,243
python
en
code
0
github-code
6
42085468466
import math print("welcome") # addition of two numbers print("enter two numbers") a = input("num1:") b = input("num2:") c = int(a) + int(b) print(c) # fibonacci series n1, n2 = 0, 1 count = 0 n = int(input("enter range")) if n <= 0: print("Please enter a positive integer") elif n == 1: ...
Ramcharantejpaka/python_lab
main.py
main.py
py
1,279
python
en
code
0
github-code
6
12096156845
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import requests from bs4 import BeautifulSoup, Tag from workflow import Workflow def main(wf): if not wf.args: return word = wf.args[0].strip() resp = requests.post("http://www.zdic.net/sousuo/", data={"q": word}) soup = BeautifulSou...
jinuljt/zdic.alfredworkflow
zdic.py
zdic.py
py
1,421
python
en
code
6
github-code
6
30357445001
from traits.api import HasTraits, Code from traitsui.api import Item, Group, View # The main demo class: class CodeEditorDemo(HasTraits): """Defines the CodeEditor demo class.""" # Define a trait to view: code_sample = Code('import sys\n\nsys.print("hello world!")') # Display specification: cod...
enthought/traitsui
traitsui/examples/demo/Standard_Editors/CodeEditor_demo.py
CodeEditor_demo.py
py
922
python
en
code
290
github-code
6
2653030207
import torch import torch.nn as nn from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence class BiLSTM(nn.Module): def __init__(self, args): super(BiLSTM, self).__init__() self.embedding_size = args.embedding_size self.hidden_size = a...
wbakst/meta-learned-embeddings
lstm.py
lstm.py
py
2,741
python
en
code
1
github-code
6
34834842463
import re f = open("processos.txt") linhas = f.readlines() datas = {} for i in linhas: new_text = re.search(r'([0-9]+)::([0-9]{4})', i) if new_text: data = new_text.group(2) processo = new_text.group(1) if (data,processo) not in datas: datas[(data,processo)] = ...
Miguelii/uminho.PLC-Project
PLC TP1/a.py
a.py
py
524
python
pt
code
0
github-code
6
71888961147
line3 = '' import re with open('txt\\论语-提取版.txt','r+',encoding="UTF-8") as f2,open('txt\\论语-原文.txt','w',encoding="UTF-8") as f3: for line in f2.readlines() : line3 = line3 + line line3 = re.sub(u'\(\d\)','',line3) # if line == '】': # del line3[-4, -1] # continue ...
fivespeedasher/Pieces
luanyu2.py
luanyu2.py
py
444
python
en
code
0
github-code
6
36396608095
""" Continuous Statistics Class """ from numbers import Number from typing import Union, Tuple from functools import wraps import inspect import numpy as np from gval.statistics.base_statistics import BaseStatistics import gval.statistics.continuous_stat_funcs as cs class ContinuousStatistics(BaseStatistics): ...
NOAA-OWP/gval
src/gval/statistics/continuous_statistics.py
continuous_statistics.py
py
9,420
python
en
code
14
github-code
6
6634407633
class Solution(object): def rotatev1(self, nums, k): """ :type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead. """ if nums is None or len(nums) ==0: return k %= n for i in range(k): ...
rh01/gofiles
lcode100-199/ex113/rotate.py
rotate.py
py
821
python
en
code
0
github-code
6
44855832216
""" Question 4.3: List of Depths: Given a binary tree, design an algorithm which creates a linked list of all the nodes at each depth (e.g., if you have a tree with depth 0, you'll have 0 linked lists). """ class TNode: def __init__(self,value): self.data = value self.left = None ...
sandeepjoshi1910/Algorithms-and-Data-Structures
List_of_Depths.py
List_of_Depths.py
py
2,206
python
en
code
0
github-code
6
3096449689
from django.shortcuts import render, render_to_response from django.utils import timezone from django.http import HttpResponse, Http404 #from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import EmptyPage, PageNotAnInteger from flynsarmy_paginator.paginator import Flynsa...
seolakim/reve-web
foodle/views.py
views.py
py
4,218
python
en
code
0
github-code
6
4457145906
# -*- coding: utf-8 -*- # Scrapy settings for wikicrawler project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'wikicrawler' SPIDER_MODULES = ['wikicrawler.sp...
Ugon/mownit
document-search-engine/wikicrawler/wikicrawler/settings.py
settings.py
py
673
python
en
code
0
github-code
6
23996964324
# Imports import pandas as pd from numpy.linalg import norm from numpy import dot from ML_Pipeline.preprocessing import preprocessing_input # Define cosine simialrity function def cos_sim(a,b): """ In our context: a: Vector 'a' represents emebedding/vector rep. of query passed b: T...
avr2002/Medical-Embeddings-and-Clinical-Trial-Search-Engine
src/ML_Pipeline/top_n.py
top_n.py
py
1,894
python
en
code
0
github-code
6
33422541294
import torch import torch.nn as nn import torch.nn.functional as F import torchvision from torchvision import datasets, models, transforms from torchvision.utils import save_image from torch.utils.data import Dataset from torchvision import datasets, models, transforms from Regressor_and_loss import disparityregressi...
Pahulmeet/Stereo_Depth_Estimation
model8.py
model8.py
py
4,908
python
en
code
0
github-code
6
74221916988
#! /usr/bin/env python3 # utf-8 # importing Hashs import hashlib from hashlib import md5 # imports sys related import os, sys import subprocess from os import system, name from time import gmtime, strftime, sleep from sys import argv # EX from zlib import * import socket import random import glob import b...
elfalehed/mush
mush.py
mush.py
py
2,562
python
en
code
7
github-code
6
14890429316
# coding:utf-8 import numpy as np import math type_ir = 5 def atan(a): val = float(a) return math.atan(val)*2/math.pi def linear_state(single_state): #print('line/single_state',single_state.shape[0]) #print('line/single_state',single_state.shape[1]) a = np.zeros((single_state.shape[0],1)) for...
kkkazumi/kensyu
test_linear.py
test_linear.py
py
1,316
python
en
code
0
github-code
6
36076113426
# instructions = open("input_day10.txt").read().strip().split("\n") # print('there are', len(instructions), 'instructions') # X = 1 # cycle = 0 # cycle_watchlist = [20, 60, 100, 140, 180, 220] # signal_strengths = [] # for ins in instructions: # print(cycle) # if ins.split()[0] == 'noop': # cyc...
Skaleras/AoC_22
day10.py
day10.py
py
1,348
python
en
code
0
github-code
6
40555963992
from django.urls import path from Web.views import Index, Persons, Random, QuotesByPerson, QuotesByCategory, CategoryCreateView, PersonCreateView, QuoteCreateView, LogoutView from Web.api_views import APIPersons, APICategories, APIQuotes, APIQuotesByPerson, APIQuotesByCategory, APIQuotesRandom urlpatterns = [ pat...
mavenium/PyQuotes
Web/urls.py
urls.py
py
1,415
python
en
code
27
github-code
6
36668954335
from abc import ABC, abstractmethod # enum and constants from enum import Enum from uuid import UUID from time import time import threading class VehicleType(Enum): # supported vehicle CAR = 'car' TRUCK = 'truck' VAN = 'van' MOTORBIKE = 'motorbike' class ParkingSpotType(Enum): # available s...
manofsteel-ab/design-patterns
oo_design/parking_lot.py
parking_lot.py
py
11,034
python
en
code
0
github-code
6
35326364696
import turtle def draw_flower(animal): animal.right(20) animal.forward(60) animal.right(20) animal.forward(60) animal.right(100) animal.forward(60) animal.right(20) animal.forward(60) def draw_something(animal): animal.forward(100) animal.right(150) animal.forwar...
RodolfoFerro/muk
Lesson03/flower.py
flower.py
py
1,016
python
en
code
0
github-code
6