Inline Files
This Python package to allow inline files -- files inside the program.
An inline file is a file stored within another file. This parent file can be any kind of file, but a .py file is preferred due to how an inline file is defined.
Synopsis
from jjinline_files import *
print(message, message2)
"""ILF
==> message
Hello World!
==> message2
And this is all for now.
"""
Definition
We use the following syntax to define an inline file:
r"""ILF
==> ID1
Hello World!
==> ID2:json
{
"hello": "world"
}
"""
Inline files are defined inside a multiline comment or docstring.
Each "file" starts with ==> ID or ==> ID:type, where ID is the
inline file's name.
In the example above, there are two inline files, "ID1" and "ID2".
ID2 has a type json.
If a "file" has an explicit type, the "file" will be
processed accordingly. For example, a JSON file will be processed
using the json module importer. Default type is text file.
Currently, the module supports the following types:
- text files (default) -- a (multiline) string
- json -- any
- yaml -- any
- jj2 -- jinja2 template -- defines a function(dict, ** args)
- f -- a f-string -- defines a function(dict, ** args)
- csv, tsv -- list(list(str))
- lines -- list(str)
- pughtml -- str
- pugjj2 -- jinja2 template in pug -- defines a function(dict, ** args)
File types and their importers
yaml and json
- typical uses: configuration files, knowledge representation
- perform yaml-parse(text);
- return a python value (list, dict, etc)
r"""ILF
from jjinline_files import *
print(f["filename"])
==> f:json
{
"filename": "calendar",
"extension": "json"
}
==> g:yaml
filename: file1
extension: yaml
"""
lines
- returns a list of strings -- text.splitlines()
csv and tsv
- performs csv-parse(txt)
- return a list(list(strings))
templates : f (fstrings) and jinja2 and pugjinja2
- return a function. Parameter:(d:dict or **args) → string
from jjinline_files import *
print( ppname(name="James Bont") )
"""ILF
==> ppname:f
surname {name.split()[-1]} fullname {name}
"""
Metadata
Release files for jjinline_files 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jjinline_files-0.1.7.tar.gz | 3.6 kB | Without provenance | Details for jjinline_files-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jjinline_files-0.1.7-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for jjinline_files-0.1.7-py2.py3-none-any.whl |
Total release size: 7.6 kB
Release files / jjinline_files-0.1.7.tar.gz
| Download URL | jjinline_files-0.1.7.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c48917ad8d620adf34fb7bac10ddc77d53b878bae1cb15739f5299ba24a3e29d
|
|
BLAKE2b-256 checksum How to use checksums |
90c4b96950d0f8b19fc2fd3be717c8aebfe60115c62e69fe856d3c64922f52bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / jjinline_files-0.1.7-py2.py3-none-any.whl
| Download URL | jjinline_files-0.1.7-py2.py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
28b876c835fd1d1aa557fd839bd7720ab07b70c7f9b519df110187df2957cf7a
|
|
BLAKE2b-256 checksum How to use checksums |
e2227d59e311f28ecbec0d22ab8d553547badf3997d15294a5bfe6977298baa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for jjinline_files 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.