From db065a11ac008e79e6495716097a8fdd1ea75714 Mon Sep 17 00:00:00 2001 From: juftin Date: Fri, 5 Jan 2024 17:36:18 -0700 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9D=20utils=20screenshot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- docs/_static/screenshot_utils.svg | 2113 +++++++++++++++++++++++++++++ 2 files changed, 2114 insertions(+), 1 deletion(-) create mode 100644 docs/_static/screenshot_utils.svg diff --git a/README.md b/README.md index 424e395..f14d714 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ in **GitHub**, over **SSH**, in **AWS S3**, **Google Cloud Storage**, or **Azure with syntax highlighting, format JSON files, render images, convert data files to navigable datatables, and more. -![](https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/screenshot_utils.png) +![](https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/screenshot_utils.svg)
Screenshots diff --git a/docs/_static/screenshot_utils.svg b/docs/_static/screenshot_utils.svg new file mode 100644 index 0000000..2c54ceb --- /dev/null +++ b/docs/_static/screenshot_utils.svg @@ -0,0 +1,2113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + browsr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ⭘ + + browsr —  + + github://juftin:browsr@v1.6.0/browsr/_utils.py [monokai] + + + + 📂  + + github://juftin:browsr@v1.6.0/ + + """ + + + + ├──  + + 📁  + + .github + + Code Browsr Utility Functions + + + + ├──  + + 📂  + + browsr + + """ + + + + │    + + ├──  + + 📄  + + __init__ + + .py + + + + │    + + ├──  + + 📄  + + __main__ + + .py + + import + + datetime + + + + │    + + ├──  + + 📄  + + _base + + .py + + import + + os + + + + │    + + ├──  + + 📄  + + _cli + + .py + + import + + pathlib + + + + │    + + ├──  + + 📄  + + _config + + .py + + from + + dataclasses + + import + + dataclass + + + + │    + + ├──  + + 📄  + + _tools + + .py + + from + + typing + + import + + Any + + , + + BinaryIO + + , + + Dict + + , + + Union + + + + │    + + ├──  + + 📄  + + _utils + + .py + + + + │    + + ├──  + + 📄  + + _version + + .py + + import + + fitz + + # type: ignore[import] + + + + │    + + ├──  + + 📄  + + browsr + + .css + + import + + rich_pixels + + + + │    + + ├──  + + 📄  + + browsr + + .py + + from + + fitz + + import + + Pixmap + + + + │    + + └──  + + 📄  + + universal_directory_tree + + .py + + from + + PIL + + import + + Image + + + + ├──  + + 📁  + + docs + + from + + rich_pixels + + import + + Pixels + + + + ├──  + + 📁  + + requirements + + from + + upath + + . + + implementations + + . + + cloud + + import + + CloudPath + + + + ├──  + + 📁  + + tests + + + + ├──  + + 📄  + + .gitignore + + + + ├──  + + 📄  + + .pre-commit-config.yaml + + def + + _open_pdf_as_image + + ( + + buf + + : + + BinaryIO + + ) + + - + + > + + Image + + . + + Image + + : + + + + ├──  + + 📄  + + .releaserc.js + + """ + + + + ├──  + + 📄  + + LICENSE + +     Open a PDF file and return a PIL.Image object + + + + ├──  + + 📄  + + mkdocs + + .yaml + +     """ + + + + ├──  + + 📄  + + pyproject + + .toml + + doc + + = + + fitz + + . + + open + + ( + + stream + + = + + buf + + . + + read + + ( + + ) + + , + + filetype + + = + + " + + pdf + + " + + ) + + + + └──  + + 📄  + + README + + .md + + pix + + : + + Pixmap + + = + + doc + + [ + + 0 + + ] + + . + + get_pixmap + + ( + + ) + + + + if + + pix + + . + + colorspace + + is + + None + + : + + + + mode + + = + + " + + L + + " + + + + elif + + pix + + . + + colorspace + + . + + n + + == + + 1 + + : + + # PLR2004 + + + + mode + + = + + " + + L + + " + + if + + pix + + . + + alpha + + == + + 0 + + else + + " + + LA + + " + + + + elif + + pix + + . + + colorspace + + . + + n + + == + + 3 + + : + + # noqa PLR2004 + + + + mode + + = + + " + + RGB + + " + + if + + pix + + . + + alpha + + == + + 0 + + else + + " + + RGBA + + " + + + + else + + : + + + + mode + + = + + " + + CMYK + + " + + + + return + + Image + + . + + frombytes + + ( + + size + + = + + ( + + pix + + . + + width + + , + + pix + + . + + height + + ) + + , + + data + + = + + pix + + . + + samples + + , + + mode + + = + + mode + + ) + + + + + + + + def + + open_image + + ( + + document + + : + + pathlib + + . + + Path + + , + + screen_width + + : + + float + + ) + + - + + > + + Pixels + + : + + + + """ + + + +     Open an image file and return a rich_pixels.Pixels object + + + +     """ + + + + with + + document + + . + + open + + ( + + " + + rb + + " + + ) + + as + + buf + + : + + + + if + + document + + . + + suffix + + . + + lower + + ( + + ) + + == + + " + + .pdf + + " + + : + + + + image + + = + + _open_pdf_as_image + + ( + + buf + + = + + buf + + ) + + + + else + + : + + + + image + + = + + Image + + . + + open + + ( + + buf + + ) + + + + image_width + + = + + image + + . + + width + + + + 🗄️️️  4KB  💾  _utils.py  📂  browsr + + + +  Q  + +  Quit  + +  F  + +  Toggle Files  + +  T  + +  Toggle Theme  + +  N  + +  Toggle Line Numbers  + +  D  + +  Toggle Dark Mode  + +  .  + +  Parent Directory  + +  X  + +  Download File  + + + + From d1d2c1dfaa6d332f8f25ffe921f05c72e058de2c Mon Sep 17 00:00:00 2001 From: juftin Date: Fri, 5 Jan 2024 17:44:11 -0700 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20screenshot=20utils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f14d714..686ed76 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ in **GitHub**, over **SSH**, in **AWS S3**, **Google Cloud Storage**, or **Azure with syntax highlighting, format JSON files, render images, convert data files to navigable datatables, and more. -![](https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/screenshot_utils.svg) +![](docs/_static/screenshot_utils.svg)
Screenshots