Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
harttraveller committed Nov 7, 2024
1 parent 8711716 commit 9471a59
Show file tree
Hide file tree
Showing 28 changed files with 283 additions and 24 deletions.
File renamed without changes.
File renamed without changes.
27 changes: 26 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# pyeio
---
title: Home
hide:
- navigation
---

# PyEIO: Python Easy Input-Output

<!-- todo: include badges here -->

## Quickstart

## Lorem Ipsum

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC

"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
1914 translation by H. Rackham

"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC

"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."
1914 translation by H. Rackham

"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."
File renamed without changes.
5 changes: 5 additions & 0 deletions docs/module/pyeio.core.io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: io
---

# `pyeio.core.io`
5 changes: 5 additions & 0 deletions docs/module/pyeio.core.web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: web
---

# `pyeio.core.web`
5 changes: 5 additions & 0 deletions docs/module/pyeio.json.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: json
---

::: pyeio.json
5 changes: 5 additions & 0 deletions docs/module/pyeio.toml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: toml
---

# `pyeio.toml`
5 changes: 5 additions & 0 deletions docs/module/pyeio.yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: yaml
---

# `pyeio.yaml`
File renamed without changes.
109 changes: 109 additions & 0 deletions docs/notebook/json.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# JSON"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"from pyeio import json"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[PosixPath('../../data/json/books.json'), PosixPath('../../data/json/wikischema.json')]\n"
]
}
],
"source": [
"test_files: list[Path] = list(Path(\"../../data/json\").glob(\"*.json\"))\n",
"print(test_files)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'books': [{'id': 1,\n",
" 'title': 'To Kill a Mockingbird',\n",
" 'author': 'Harper Lee',\n",
" 'year': 1960,\n",
" 'genres': ['Fiction', 'Classic', 'Coming-of-age'],\n",
" 'rating': 4.27,\n",
" 'inStock': True},\n",
" {'id': 2,\n",
" 'title': '1984',\n",
" 'author': 'George Orwell',\n",
" 'year': 1949,\n",
" 'genres': ['Fiction', 'Dystopian', 'Political'],\n",
" 'rating': 4.18,\n",
" 'inStock': False},\n",
" {'id': 3,\n",
" 'title': 'Pride and Prejudice',\n",
" 'author': 'Jane Austen',\n",
" 'year': 1813,\n",
" 'genres': ['Fiction', 'Romance', 'Classic'],\n",
" 'rating': 4.25,\n",
" 'inStock': True}],\n",
" 'totalBooks': 3,\n",
" 'lastUpdated': '2023-05-15T14:30:00Z'}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"json.open(test_files[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "pyeio",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
23 changes: 23 additions & 0 deletions docs/notebook/toml.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# TOML"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
23 changes: 21 additions & 2 deletions docs/notebook/yaml.ipynb
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
{
"cells": [],
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# YAML"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "pyeio",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"name": "python",
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
4 changes: 0 additions & 4 deletions docs/requirements.txt

This file was deleted.

52 changes: 46 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
site_name: "PyEIO: Python Easy Input-Output"
site_name: PyEIO
site_url: https://harttraveller.github.io/pyeio
repo_name: harttraveller/pyeio
repo_url: https://github.com/harttraveller/pyeio

plugins:
- search
- roamlinks
- mkdocs-jupyter
- mkdocstrings:
handlers:
python:
options:
show_object_full_path: true
show_root_heading: true
heading_level: 1

# - mkdocstrings:
# handlers:
# python:
# options:
# show_root_heading: true
# show_object_full_path: true
# allow_inspection: true
# show_bases: false
# parameter_headings: false

theme:
name: material
Expand All @@ -16,17 +35,20 @@ theme:
accent: orange
features:
- navigation.tracking
- navigation.expand
- navigation.tabs
- navigation.indexes
- navigation.instant
- navitation.instant.progress
# - navigation.footer
- search.suggest
- search.share
- content.code.copy
- content.code.annotate
- header.autohide
- navigation.footer
- navigation.tabs

extra:
generator: false
# extra:
# generator: false

# extra_css:
# - static/extra.css
Expand All @@ -39,6 +61,9 @@ markdown_extensions:
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- toc:
title: Go To
permalink: true
- pymdownx.highlight:
anchor_linenums: true
use_pygments: true
Expand All @@ -48,4 +73,19 @@ markdown_extensions:
alternate_style: true

nav:
- About: "index.md"
- index.md
- Tutorial Notebooks:
- notebook/index.md
- notebook/json.ipynb
- Module Reference:
- module/index.md
- module/pyeio.json.md
- module/pyeio.toml.md
- module/pyeio.yaml.md
- core:
- module/pyeio.core.io.md
- module/pyeio.core.web.md
# - meta:
# - tool:
- Developer Notes:
- developer/index.md
File renamed without changes.
1 change: 1 addition & 0 deletions pyeio/base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import data, exception, literal, validation
2 changes: 1 addition & 1 deletion pyeio/base/index.py → pyeio/base/data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import get_args
from pyeio.base.types import FileExtension, VariantFileExtension
from pyeio.base.literal import FileExtension, VariantFileExtension

file_extensions: tuple[str, ...] = get_args(FileExtension)

Expand Down
8 changes: 4 additions & 4 deletions pyeio/base/exceptions.py → pyeio/base/exception.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional
from pyeio.base.index import file_extensions
from pyeio import __meta__
from pyeio.base.data import file_extensions
from pyeio import __info__


class UnexpectedError(Exception):
Expand All @@ -15,7 +15,7 @@ def __init__(
if details:
self.message += f"\nDetails: {details}"
if issues:
self.message += f"\nPlease submit a GitHub issue with the code that generated this error at:\n{__meta__.__issues__}"
self.message += f"\nPlease submit a GitHub issue with the code that generated this error at:\n{__info__.__issues__}"
super().__init__(self.message)


Expand All @@ -35,7 +35,7 @@ def __init__(

class MissingExtraError(Exception):
def __init__(self, extra: str, *args: object) -> None:
self.message = f"To use this module install: '{__meta__.__package__}[{extra}]'"
self.message = f"To use this module install: '{__info__.__package__}[{extra}]'"
super().__init__(*args)


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9471a59

Please sign in to comment.