repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/demo.py | test/demo.py | #encoding=utf-8
from __future__ import unicode_literals
import sys
sys.path.append("../")
import jieba
import jieba.posseg
import jieba.analyse
print('='*40)
print('1. 分词')
print('-'*40)
seg_list = jieba.cut("我来到北京清华大学", cut_all=True)
print("Full Mode: " + "/ ".join(seg_list)) # 全模式
seg_list = jieba.cut("我来到北京清华大学... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_paddle_postag.py | test/test_paddle_postag.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba.posseg as pseg
import jieba
jieba.enable_paddle()
def cuttest(test_sent):
result = pseg.cut(test_sent, use_paddle=True)
for word, flag in result:
print('%s %s' % (word, flag))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_whoosh_file.py | test/test_whoosh_file.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys
import os
sys.path.append("../")
from whoosh.index import create_in
from whoosh.fields import *
from whoosh.qparser import QueryParser
from jieba.analyse import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEXT(stored=Tr... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_no_hmm.py | test/test_no_hmm.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent,HMM=False)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest("工信处女干事每月经过下属科... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/extract_tags.py | test/extract_tags.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
sys.exit(1... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_whoosh.py | test/test_whoosh.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys,os
sys.path.append("../")
from whoosh.index import create_in,open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser
from jieba.analyse.analyzer import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEX... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_cut_for_search.py | test/test_cut_for_search.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut_for_search(test_sent)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_multithread.py | test/test_multithread.py | #encoding=utf-8
import sys
import threading
sys.path.append("../")
import jieba
class Worker(threading.Thread):
def run(self):
seg_list = jieba.cut("我来到北京清华大学",cut_all=True)
print("Full Mode:" + "/ ".join(seg_list)) #全模式
seg_list = jieba.cut("我来到北京清华大学",cut_all=False)
print("Defau... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/extract_tags_stop_words.py | test/extract_tags_stop_words.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_stop_words.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/jieba_test.py | test/jieba_test.py | #-*-coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import sys
sys.path.append("../")
import unittest
import types
import jieba
if sys.version_info[0] > 2:
from imp import reload
jieba.initialize()
test_contents = [
"这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。",
"我不喜欢日本和服。",
"雷猴回... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_change_dictpath.py | test/test_change_dictpath.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent)
print(" ".join(result))
def testcase():
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest(... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_whoosh_file_read.py | test/test_whoosh_file_read.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
import sys
import os
sys.path.append("../")
from whoosh.index import create_in,open_dir
from whoosh.fields import *
from whoosh.qparser import QueryParser
from jieba.analyse import ChineseAnalyzer
analyzer = ChineseAnalyzer()
schema = Schema(title=TEXT... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test.py | test/test.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。")
cuttest("工信处女干事每月经过下属科室都要亲口交代24口... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_cutall.py | test/test_cutall.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
def cuttest(test_sent):
result = jieba.cut(test_sent,cut_all=True)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Pytho... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_tokenize_no_hmm.py | test/test_tokenize_no_hmm.py | #encoding=utf-8
from __future__ import print_function,unicode_literals
import sys
sys.path.append("../")
import jieba
g_mode="default"
def cuttest(test_sent):
global g_mode
result = jieba.tokenize(test_sent,mode=g_mode,HMM=False)
for tk in result:
print("word %s\t\t start: %d \t\t end:%d" % (tk[0]... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/jiebacmd.py | test/jiebacmd.py | '''
usage example (find top 100 words in abc.txt):
cat abc.txt | python jiebacmd.py | sort | uniq -c | sort -nr -k1 | head -100
'''
from __future__ import unicode_literals
import sys
sys.path.append("../")
import jieba
default_encoding='utf-8'
if len(sys.argv)>1:
default_encoding = sys.argv[1]
while True:
... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/extract_topic.py | test/extract_topic.py | import sys
sys.path.append("../")
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn import decomposition
import jieba
import time
import glob
import sys
import os
import random
if len(sys.argv)<2:
print("usage: extract_topic.py di... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test_file.py | test/parallel/test_file.py | import sys
import time
sys.path.append("../../")
import jieba
jieba.enable_parallel()
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = "/ ".join(jieba.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","wb")
log_f.write(words.encode('utf-8'))
print('speed %s bytes/second'... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test_pos.py | test/parallel/test_pos.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
import jieba.posseg as pseg
def cuttest(test_sent):
result = pseg.cut(test_sent)
for w in result:
print(w.word, "/", w.flag, ", ", end=' ')
print("")
if __name__ == "... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test_pos_file.py | test/parallel/test_pos_file.py | from __future__ import print_function
import sys,time
import sys
sys.path.append("../../")
import jieba
import jieba.posseg as pseg
jieba.enable_parallel(4)
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = list(pseg.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","w")
l... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test2.py | test/parallel/test2.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut(test_sent,cut_all=True)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/extract_tags.py | test/parallel/extract_tags.py | import sys
sys.path.append('../../')
import jieba
jieba.enable_parallel(4)
import jieba.analyse
from optparse import OptionParser
USAGE ="usage: python extract_tags.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k",dest="topK")
opt, args = parser.parse_args()
if len(args) <1:
pr... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test_cut_for_search.py | test/parallel/test_cut_for_search.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut_for_search(test_sent)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test_disable_hmm.py | test/parallel/test_disable_hmm.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut(test_sent, HMM=False)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/parallel/test.py | test/parallel/test.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../../")
import jieba
jieba.enable_parallel(4)
def cuttest(test_sent):
result = jieba.cut(test_sent)
for word in result:
print(word, "/", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/cog_predict.py | cog_predict.py | # flake8: noqa
# This file is used for deploying replicate models
# running: cog predict -i img=@inputs/00017_gray.png -i version='General - v3' -i scale=2 -i face_enhance=True -i tile=0
# push: cog push r8.im/xinntao/realesrgan
import os
os.system('pip install gfpgan')
os.system('python setup.py develop')
import cv... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/inference_realesrgan_video.py | inference_realesrgan_video.py | import argparse
import cv2
import glob
import mimetypes
import numpy as np
import os
import shutil
import subprocess
import torch
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.utils.download_util import load_file_from_url
from os import path as osp
from tqdm import tqdm
from realesrgan import RealESRGANe... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/inference_realesrgan.py | inference_realesrgan.py | import argparse
import cv2
import glob
import os
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.utils.download_util import load_file_from_url
from realesrgan import RealESRGANer
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
def main():
"""Inference demo for Real-ESRGAN.
"""
parser ... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/setup.py | setup.py | #!/usr/bin/env python
from setuptools import find_packages, setup
import os
import subprocess
import time
version_file = 'realesrgan/version.py'
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
def get_git_hash():
def _minimal_ext_cmd(cmd):
... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/scripts/pytorch2onnx.py | scripts/pytorch2onnx.py | import argparse
import torch
import torch.onnx
from basicsr.archs.rrdbnet_arch import RRDBNet
def main(args):
# An instance of the model
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
if args.params:
keyname = 'params'
else:
keyname = 'pa... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/scripts/generate_meta_info_pairdata.py | scripts/generate_meta_info_pairdata.py | import argparse
import glob
import os
def main(args):
txt_file = open(args.meta_info, 'w')
# sca images
img_paths_gt = sorted(glob.glob(os.path.join(args.input[0], '*')))
img_paths_lq = sorted(glob.glob(os.path.join(args.input[1], '*')))
assert len(img_paths_gt) == len(img_paths_lq), ('GT folder ... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/scripts/extract_subimages.py | scripts/extract_subimages.py | import argparse
import cv2
import numpy as np
import os
import sys
from basicsr.utils import scandir
from multiprocessing import Pool
from os import path as osp
from tqdm import tqdm
def main(args):
"""A multi-thread tool to crop large images to sub-images for faster IO.
opt (dict): Configuration dict. It co... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/scripts/generate_meta_info.py | scripts/generate_meta_info.py | import argparse
import cv2
import glob
import os
def main(args):
txt_file = open(args.meta_info, 'w')
for folder, root in zip(args.input, args.root):
img_paths = sorted(glob.glob(os.path.join(folder, '*')))
for img_path in img_paths:
status = True
if args.check:
... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/scripts/generate_multiscale_DF2K.py | scripts/generate_multiscale_DF2K.py | import argparse
import glob
import os
from PIL import Image
def main(args):
# For DF2K, we consider the following three scales,
# and the smallest image whose shortest edge is 400
scale_list = [0.75, 0.5, 1 / 3]
shortest_edge = 400
path_list = sorted(glob.glob(os.path.join(args.input, '*')))
... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/tests/test_utils.py | tests/test_utils.py | import numpy as np
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan.utils import RealESRGANer
def test_realesrganer():
# initialize with default model
restorer = RealESRGANer(
scale=4,
model_path='experiments/pretrained_models/RealESRGAN_x4plus.pth',
model=None,
... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/tests/test_model.py | tests/test_model.py | import torch
import yaml
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.data.paired_image_dataset import PairedImageDataset
from basicsr.losses.losses import GANLoss, L1Loss, PerceptualLoss
from realesrgan.archs.discriminator_arch import UNetDiscriminatorSN
from realesrgan.models.realesrgan_model import R... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/tests/test_discriminator_arch.py | tests/test_discriminator_arch.py | import torch
from realesrgan.archs.discriminator_arch import UNetDiscriminatorSN
def test_unetdiscriminatorsn():
"""Test arch: UNetDiscriminatorSN."""
# model init and forward (cpu)
net = UNetDiscriminatorSN(num_in_ch=3, num_feat=4, skip_connection=True)
img = torch.rand((1, 3, 32, 32), dtype=torch.... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/tests/test_dataset.py | tests/test_dataset.py | import pytest
import yaml
from realesrgan.data.realesrgan_dataset import RealESRGANDataset
from realesrgan.data.realesrgan_paired_dataset import RealESRGANPairedDataset
def test_realesrgan_dataset():
with open('tests/data/test_realesrgan_dataset.yml', mode='r') as f:
opt = yaml.load(f, Loader=yaml.FullL... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/train.py | realesrgan/train.py | # flake8: noqa
import os.path as osp
from basicsr.train import train_pipeline
import realesrgan.archs
import realesrgan.data
import realesrgan.models
if __name__ == '__main__':
root_path = osp.abspath(osp.join(__file__, osp.pardir, osp.pardir))
train_pipeline(root_path)
| python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/utils.py | realesrgan/utils.py | import cv2
import math
import numpy as np
import os
import queue
import threading
import torch
from basicsr.utils.download_util import load_file_from_url
from torch.nn import functional as F
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class RealESRGANer():
"""A helper class for upsampl... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/__init__.py | realesrgan/__init__.py | # flake8: noqa
from .archs import *
from .data import *
from .models import *
from .utils import *
from .version import *
| python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/models/realesrnet_model.py | realesrgan/models/realesrnet_model.py | import numpy as np
import random
import torch
from basicsr.data.degradations import random_add_gaussian_noise_pt, random_add_poisson_noise_pt
from basicsr.data.transforms import paired_random_crop
from basicsr.models.sr_model import SRModel
from basicsr.utils import DiffJPEG, USMSharp
from basicsr.utils.img_process_uti... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/models/__init__.py | realesrgan/models/__init__.py | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import model modules for registry
# scan all the files that end with '_model.py' under the model folder
model_folder = osp.dirname(osp.abspath(__file__))
model_filenames = [osp.splitext(osp.basename(v))[0] for v in s... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/models/realesrgan_model.py | realesrgan/models/realesrgan_model.py | import numpy as np
import random
import torch
from basicsr.data.degradations import random_add_gaussian_noise_pt, random_add_poisson_noise_pt
from basicsr.data.transforms import paired_random_crop
from basicsr.models.srgan_model import SRGANModel
from basicsr.utils import DiffJPEG, USMSharp
from basicsr.utils.img_proce... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/archs/discriminator_arch.py | realesrgan/archs/discriminator_arch.py | from basicsr.utils.registry import ARCH_REGISTRY
from torch import nn as nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm
@ARCH_REGISTRY.register()
class UNetDiscriminatorSN(nn.Module):
"""Defines a U-Net discriminator with spectral normalization (SN)
It is used in Real-ESRGAN... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/archs/srvgg_arch.py | realesrgan/archs/srvgg_arch.py | from basicsr.utils.registry import ARCH_REGISTRY
from torch import nn as nn
from torch.nn import functional as F
@ARCH_REGISTRY.register()
class SRVGGNetCompact(nn.Module):
"""A compact VGG-style network structure for super-resolution.
It is a compact network structure, which performs upsampling in the last ... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/archs/__init__.py | realesrgan/archs/__init__.py | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import arch modules for registry
# scan all the files that end with '_arch.py' under the archs folder
arch_folder = osp.dirname(osp.abspath(__file__))
arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scand... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/data/realesrgan_dataset.py | realesrgan/data/realesrgan_dataset.py | import cv2
import math
import numpy as np
import os
import os.path as osp
import random
import time
import torch
from basicsr.data.degradations import circular_lowpass_kernel, random_mixed_kernels
from basicsr.data.transforms import augment
from basicsr.utils import FileClient, get_root_logger, imfrombytes, img2tensor
... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/data/__init__.py | realesrgan/data/__init__.py | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import dataset modules for registry
# scan all the files that end with '_dataset.py' under the data folder
data_folder = osp.dirname(osp.abspath(__file__))
dataset_filenames = [osp.splitext(osp.basename(v))[0] for v ... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
xinntao/Real-ESRGAN | https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/realesrgan/data/realesrgan_paired_dataset.py | realesrgan/data/realesrgan_paired_dataset.py | import os
from basicsr.data.data_util import paired_paths_from_folder, paired_paths_from_lmdb
from basicsr.data.transforms import augment, paired_random_crop
from basicsr.utils import FileClient, imfrombytes, img2tensor
from basicsr.utils.registry import DATASET_REGISTRY
from torch.utils import data as data
from torchv... | python | BSD-3-Clause | a4abfb2979a7bbff3f69f58f58ae324608821e27 | 2026-01-04T14:42:37.263297Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/12_exceptions.py | Basic/12_exceptions.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=32030
### Exception Handling ###
numberOne = 5
numberTwo = 1
numberTwo = "1"
# Excepción base: try except
try:
print(numberOne + numberTwo)
print("No se ha producido un error")
except:
# Se ejecuta si se produce una excepción
print("Se ha producido un... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/04_lists.py | Basic/04_lists.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=10872
### Lists ###
# Definición
my_list = list()
my_other_list = []
print(len(my_list))
my_list = [35, 24, 62, 52, 30, 30, 17]
print(my_list)
print(len(my_list))
my_other_list = [35, 1.77, "Brais", "Moure"]
print(type(my_list))
print(type(my_other_list))
# Acce... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/07_dicts.py | Basic/07_dicts.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc
### Dictionaries ###
# Definición
my_dict = dict()
my_other_dict = {}
print(type(my_dict))
print(type(my_other_dict))
my_other_dict = {"Nombre": "Brais",
"Apellido": "Moure", "Edad": 35, 1: "Python"}
my_dict = {
"Nombre": "Brais",
"Apellido":... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/01_variables.py | Basic/01_variables.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=2938
### Variables ###
my_string_variable = "My String variable"
print(my_string_variable)
my_int_variable = 5
print(my_int_variable)
my_int_to_str_variable = str(my_int_variable)
print(my_int_to_str_variable)
print(type(my_int_to_str_variable))
my_bool_variable = F... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/08_conditionals.py | Basic/08_conditionals.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=21442
### Conditionals ###
# if
my_condition = False
if my_condition: # Es lo mismo que if my_condition == True:
print("Se ejecuta la condición del if")
my_condition = 5 * 5
if my_condition == 10:
print("Se ejecuta la condición del segundo if")
# if, elif... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/00_helloworld.py | Basic/00_helloworld.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc
### Hola Mundo ###
# Nuestro hola mundo en Python
print("Hola Python")
print('Hola Python')
# Esto es un comentario
"""
Este es un
comentario
en varias líneas
"""
'''
Este también es un
comentario
en varias líneas
'''
# Cómo consultar el tipo de dato
print(type("Soy ... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/11_classes.py | Basic/11_classes.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=29327
### Classes ###
# Definición
class MyEmptyPerson:
pass # Para poder dejar la clase vacía
print(MyEmptyPerson)
print(MyEmptyPerson())
# Clase con constructor, funciones y propiedades privadas y públicas
class Person:
def __init__(self, name, surname... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/13_modules.py | Basic/13_modules.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=34583
### Modules ###
from math import pi as PI_VALUE
import math
from my_module import sumValue, printValue
import my_module
my_module.sumValue(5, 3, 1)
my_module.printValue("Hola Python!")
sumValue(5, 3, 1)
printValue("Hola python")
print(math.pi)
print(math.pow... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/09_loops.py | Basic/09_loops.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=23822
### Loops ###
# While
my_condition = 0
while my_condition < 10:
print(my_condition)
my_condition += 2
else: # Es opcional
print("Mi condición es mayor o igual que 10")
print("La ejecución continúa")
while my_condition < 20:
my_condition += 1
... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/10_functions.py | Basic/10_functions.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=26619
### Functions ###
# Definición
def my_function():
print("Esto es una función")
my_function()
my_function()
my_function()
# Función con parámetros de entrada/argumentos
def sum_two_values(first_value: int, second_value):
print(first_value + second_va... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/06_sets.py | Basic/06_sets.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=16335
### Sets ###
# Definición
my_set = set()
my_other_set = {}
print(type(my_set))
print(type(my_other_set)) # Inicialmente es un diccionario
my_other_set = {"Brais", "Moure", 35}
print(type(my_other_set))
print(len(my_other_set))
# Inserción
my_other_set.add(... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/my_module.py | Basic/my_module.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=34583
### Módulo para pruebas ###
def sumValue(numberOne, numberTwo, numberThree):
print(numberOne + numberTwo + numberThree)
def printValue(value):
print(value)
| python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/05_tuples.py | Basic/05_tuples.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=14711
### Tuples ###
# Definición
my_tuple = tuple()
my_other_tuple = ()
my_tuple = (35, 1.77, "Brais", "Moure", "Brais")
my_other_tuple = (35, 60, 30)
print(my_tuple)
print(type(my_tuple))
# Acceso a elementos y búsqueda
print(my_tuple[0])
print(my_tuple[-1])
# p... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/03_strings.py | Basic/03_strings.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=8643
### Strings ###
my_string = "Mi String"
my_other_string = 'Mi otro String'
print(len(my_string))
print(len(my_other_string))
print(my_string + " " + my_other_string)
my_new_line_string = "Este es un String\ncon salto de línea"
print(my_new_line_string)
my_tab_s... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Basic/02_operators.py | Basic/02_operators.py | # Clase en vídeo: https://youtu.be/Kp4Mvapo5kc?t=5665
### Operadores Aritméticos ###
# Operaciones con enteros
print(3 + 4)
print(3 - 4)
print(3 * 4)
print(3 / 4)
print(10 % 3)
print(10 // 3)
print(2 ** 3)
print(2 ** 3 + 3 - 7 / 1 // 4)
# Operaciones con cadenas de texto
print("Hola " + "Python " + "¿Qué tal?")
prin... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/07_regular_expressions.py | Intermediate/07_regular_expressions.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=19762
### Regular Expressions ###
import re
# match
my_string = "Esta es la lección número 7: Lección llamada Expresiones Regulares"
my_other_string = "Esta no es la lección número 6: Manejo de ficheros"
match = re.match("Esta es la lección", my_string, re.I)
print(... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/04_higher_order_functions.py | Intermediate/04_higher_order_functions.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=10172
### Higher Order Functions ###
from functools import reduce
def sum_one(value):
return value + 1
def sum_five(value):
return value + 5
def sum_two_values_and_add_value(first_value, second_value, f_sum):
return f_sum(first_value + second_value)
... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/05_error_types.py | Intermediate/05_error_types.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=12721
### Error Types ###
# SyntaxError
# print "¡Hola comunidad!" # Descomentar para Error
from math import pi
import math
print("¡Hola comunidad!")
# NameError
language = "Spanish" # Comentar para Error
print(language)
# IndexError
my_list = ["Python", "Swift", "K... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/08_python_package_manager.py | Intermediate/08_python_package_manager.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=24010
### Python Package Manager ###
# PIP https://pypi.org
# pip install pip
# pip --version
# pip install numpy
import pandas
from mypackage import arithmetics
import requests
import numpy
print(numpy.version.version)
numpy_array = numpy.array([35, 24, 62, 52, 30... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/03_lambdas.py | Intermediate/03_lambdas.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=9145
### Lambdas ###
sum_two_values = lambda first_value, second_value: first_value + second_value
print(sum_two_values(2, 4))
multiply_values = lambda first_value, second_value: first_value * second_value - 3
print(multiply_values(2, 4))
def sum_three_values(value):... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/02_challenges.py | Intermediate/02_challenges.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=4142
### Challenges ###
"""
EL FAMOSO "FIZZ BUZZ”:
Escribe un programa que muestre por consola (con un print) los
números de 1 a 100 (ambos incluidos y con un salto de línea entre
cada impresión), sustituyendo los siguientes:
- Múltiplos de 3 por la palabra "fizz".
- M... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/06_file_handling.py | Intermediate/06_file_handling.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=15524
### File Handling ###
import xml
import csv
import json
import os
# .txt file
# Leer, escribir y sobrescribir si ya existe
txt_file = open("my_file.txt", "w+")
txt_file.write(
"Mi nombre es Brais\nMi apellido es Moure\n35 años\nY mi lenguaje preferido es P... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/01_list_comprehension.py | Intermediate/01_list_comprehension.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=3239
### List Comprehension ###
my_original_list = [0, 1, 2, 3, 4, 5, 6, 7]
print(my_original_list)
my_range = range(8)
print(list(my_range))
# Definición
my_list = [i + 1 for i in range(8)]
print(my_list)
my_list = [i * 2 for i in range(8)]
print(my_list)
my_list... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/00_dates.py | Intermediate/00_dates.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU
### Dates ###
# Date time
from datetime import timedelta
from datetime import date
from datetime import time
from datetime import datetime
now = datetime.now()
def print_date(date):
print(date.year)
print(date.month)
print(date.day)
print(date.hour)
... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/mypackage/__init__.py | Intermediate/mypackage/__init__.py | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false | |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Intermediate/mypackage/arithmetics.py | Intermediate/mypackage/arithmetics.py | # Clase en vídeo: https://youtu.be/TbcEqkabAWU?t=24010
### Arithmetics ###
def sum_two_values(first_value, second_value):
return first_value + second_value
| python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/type_hints.py | Backend/type_hints.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=1810
### Type Hints ###
my_string_variable = "My String variable"
print(my_string_variable)
print(type(my_string_variable))
my_string_variable = 5
print(my_string_variable)
print(type(my_string_variable))
my_typed_variable: str = "My typed String variable"
print(my_t... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/main.py | Backend/FastAPI/main.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A
### Hola Mundo ###
# Documentación oficial: https://fastapi.tiangolo.com/es/
# Instala FastAPI: pip install "fastapi[all]"
from fastapi import FastAPI
from routers import products, users, basic_auth_users, jwt_auth_users, users_db
from fastapi.staticfiles import Static... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/db/client.py | Backend/FastAPI/db/client.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=20480)
### MongoDB client ###
# Descarga versión community: https://www.mongodb.com/try/download
# Instalación:https://www.mongodb.com/docs/manual/tutorial
# Módulo conexión MongoDB: pip install pymongo
# Ejecución: sudo mongod --dbpath "/path/a/la/base/de/datos/"
# Co... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/db/schemas/user.py | Backend/FastAPI/db/schemas/user.py | # Clase en vídeo (22/12/2022): https://www.twitch.tv/videos/1686104006
### User schema ###
def user_schema(user) -> dict:
return {"id": str(user["_id"]),
"username": user["username"],
"email": user["email"]}
def users_schema(users) -> list:
return [user_schema(user) for user in users... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/db/models/user.py | Backend/FastAPI/db/models/user.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=20480
### User model ###
from pydantic import BaseModel
from typing import Optional
class User(BaseModel):
id: Optional[str] = None
username: str
email: str
| python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/routers/users_db.py | Backend/FastAPI/routers/users_db.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=20480
### Users DB API ###
from fastapi import APIRouter, HTTPException, status
from db.models.user import User
from db.schemas.user import user_schema, users_schema
from db.client import db_client
from bson import ObjectId
router = APIRouter(
prefix="/userdb",
... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/routers/jwt_auth_users.py | Backend/FastAPI/routers/jwt_auth_users.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=17664
### Users API con autorización OAuth2 JWT ###
from fastapi import APIRouter, Depends, HTTPException, status
from pydantic import BaseModel
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from jose import jwt, JWTError
from passlib.con... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/routers/users.py | Backend/FastAPI/routers/users.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=5382
### Users API ###
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
# Inicia el server: uvicorn users:app --reload
router = APIRouter()
class User(BaseModel):
id: int
name: str
surname: str
url: str
age: int
user... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/routers/basic_auth_users.py | Backend/FastAPI/routers/basic_auth_users.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=14094
### Users API con autorización OAuth2 básica ###
from fastapi import APIRouter, Depends, HTTPException, status
from pydantic import BaseModel
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
router = APIRouter(
prefix="/basicauth"... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
mouredev/Hello-Python | https://github.com/mouredev/Hello-Python/blob/55e1bb457840762b6589ab50a66e605a2cea6457/Backend/FastAPI/routers/products.py | Backend/FastAPI/routers/products.py | # Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=12475
### Products API ###
from fastapi import APIRouter
router = APIRouter(
prefix="/products",
tags=["products"],
responses={404: {"message": "No encontrado"}}
)
products_list = ["Producto 1", "Producto 2", "Producto 3", "Producto 4", "Producto 5"]
@r... | python | Apache-2.0 | 55e1bb457840762b6589ab50a66e605a2cea6457 | 2026-01-04T14:42:40.012707Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/locations.py | src/poetry/locations.py | from __future__ import annotations
import os
from pathlib import Path
from platformdirs import user_cache_path
from platformdirs import user_config_path
from platformdirs import user_data_path
_APP_NAME = "pypoetry"
DEFAULT_CACHE_DIR = user_cache_path(_APP_NAME, appauthor=False)
CONFIG_DIR = Path(
os.getenv("... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/exceptions.py | src/poetry/exceptions.py | from __future__ import annotations
class PoetryError(Exception):
pass
| python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/__main__.py | src/poetry/__main__.py | from __future__ import annotations
import sys
if __name__ == "__main__":
from poetry.console.application import main
sys.exit(main())
| python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/factory.py | src/poetry/factory.py | from __future__ import annotations
import contextlib
import logging
import re
from typing import TYPE_CHECKING
from typing import Any
from typing import cast
from cleo.io.null_io import NullIO
from packaging.utils import NormalizedName
from packaging.utils import canonicalize_name
from poetry.core.constraints.versio... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/poetry.py | src/poetry/poetry.py | from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Any
from typing import cast
from poetry.core.poetry import Poetry as BasePoetry
from poetry.__version__ import __version__
from poetry.config.source import Source
from poetry.pyproject.toml import PyProjectTOML
if TYPE_CHECKING:... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/__version__.py | src/poetry/__version__.py | from __future__ import annotations
from importlib import metadata
__version__ = metadata.version("poetry")
| python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/masonry/api.py | src/poetry/masonry/api.py | from __future__ import annotations
from poetry.core.masonry.api import build_sdist
from poetry.core.masonry.api import build_wheel
from poetry.core.masonry.api import get_requires_for_build_sdist
from poetry.core.masonry.api import get_requires_for_build_wheel
from poetry.core.masonry.api import prepare_metadata_for_b... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/masonry/__init__.py | src/poetry/masonry/__init__.py | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false | |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/masonry/builders/editable.py | src/poetry/masonry/builders/editable.py | from __future__ import annotations
import csv
import hashlib
import json
import os
from base64 import urlsafe_b64encode
from pathlib import Path
from typing import TYPE_CHECKING
from poetry.core.masonry.builders.builder import Builder
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.mason... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/masonry/builders/__init__.py | src/poetry/masonry/builders/__init__.py | from __future__ import annotations
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.masonry.builders.wheel import WheelBuilder
from poetry.masonry.builders.editable import EditableBuilder
__all__ = ["BUILD_FORMATS", "EditableBuilder"]
# might be extended by plugins
BUILD_FORMATS = {
... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/version/version_selector.py | src/poetry/version/version_selector.py | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from poetry.core.packages.package import Package
from poetry.repositories import RepositoryPool
class VersionSelector:
def __init__(self, pool: RepositoryPool) -> None:
self._pool = pool
def find_best_ca... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/version/__init__.py | src/poetry/version/__init__.py | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false | |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/vcs/__init__.py | src/poetry/vcs/__init__.py | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false | |
python-poetry/poetry | https://github.com/python-poetry/poetry/blob/5e1fd5e6cb391beb2b3292b28680461408760ae1/src/poetry/vcs/git/system.py | src/poetry/vcs/git/system.py | from __future__ import annotations
import os
import subprocess
from typing import TYPE_CHECKING
from dulwich.client import find_git_command
if TYPE_CHECKING:
from pathlib import Path
from typing import Any
class SystemGit:
@classmethod
def clone(cls, repository: str, dest: Path) -> None:
... | python | MIT | 5e1fd5e6cb391beb2b3292b28680461408760ae1 | 2026-01-04T14:42:33.943988Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.