jtf


Namejtf JSON
Version 1.1.15 PyPI version JSON
download
home_pageNone
SummaryUtilities for interacting with .jtf files.
upload_time2024-08-19 16:17:34
maintainerNone
docs_urlNone
authorTimothy Phillips
requires_python>=3.12
licenseMIT License Copyright (c) 2024 Tim Phillips Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords json table spreadsheet fileformat utility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jtf.py

Python utilities for interacting with .jtf files.

[View main repository.](https://github.com/NotTimTam/jtf)

[Read the syntax standard.](https://github.com/NotTimTam/jtf/blob/main/SYNTAX.md)

[View an example JTF file.](https://github.com/NotTimTam/jtf/blob/main/example.jtf)

This package is a direct conversion of the main JTF utilities. While the functions within this package use Python wording (like `list` instead of `array`), the casing required by the [JTF standard](https://github.com/NotTimTam/jtf/blob/main/SYNTAX.md) still applies when creating/parsing documents.

Requires Python 3.12 or newer.

# Installation

```terminal
pip install jtf
```

# Usage

```python
from jtf import JTF

document = JTF.parse("<document data>")
```

# Reference

## JTF Class

### Import

```python
from jtf import JTF
```

### `JTF.target_list_includes_cell(target, x, y)`

Checks if a target list targets a specific coordinate.

Parameters:

-   target (List<number|string>): The target list to check.
-   x (number|string): The x-coordinate to check.
-   y (number|string): The y-coordinate to check.

Returns `True` if the target list includes the specified coordinate, otherwise `False`.

### `JTF.parse(data)`

Parses JTF data into a readable object.

Parameters:

-   data (string|obj): The data to parse.

Returns an instance of the `Document` class based on the parsed data.

### `JTF.stringify(document)`

Convert a [`Document`](#document-class) object into a string.

-   document ([`Document`](#document-class)): The document to stringify.

Returns a string of the document's source data.

## Document Class

Generated by JTF class' [`parse`](#jtfparsedata) method.

### `Document.get_cell(table, x, y)`

Retrieves the content of a cell in a specified table.

Parameters:

-   table: The index of the table.
-   x: The x-coordinate of the cell.
-   y: The y-coordinate of the cell.

Returns the content of the cell, or `None` if the cell does not exist.

### `Document.to_csv()`

Converts each table in the document into CSV format.

Returns an object containing CSV strings for each table in the document.

### `Document.to_list()`

Converts each table in the document into lists.

Returns an object containing lists for each table in the document.

### `Document.stringify()`

Returns the data object represented by a JTF string.

### `Document.update_updated_at()`

Updates the document's `updatedAt` value to be the current timestamp.

### `Document.set_table(index, value)`

Set a table to a value. **Will overwrite existing tables.**

Parameters:

-   index (string|number): The index of the table.
-   data: The data to set.

### `Document.get_extra_processor_data(processor)`

Parameters:

-   processor (string): The unique identifier the data is stored under.

Returns a data object if found, or `None` if no object was found.

### `Document.set_extra_processor_data(processor, data, extend)`

Overwrites or updates data objects defined in a document's `metadata.extra` object.

Parameters:

-   processor (string): The unique identifier the data is stored under.
-   data (obj): An object of extra data to set.
-   extend (boolean): If `True`, destructures the new data object into existing data instead of overwriting it. (default `False`)

### `Document.tables`

An integer-string index of [`Table`](#table-class) objects.

### `Document.source`

The document's source object. This is the raw data that is parsed in `JTF.parse()`.

## Table Class

Generated by Document class and stored under `Document.tables` object.

### `Table.get_cell_styles(x, y)`

Retrieves the styles that must be applied to a cell.

Parameters:

-   x (string|number): The x-coordinate of the cell.
-   y (string|number): The y-coordinate of the cell.

Returns an object containing the classes and styles to apply to this cell.

### `Table.get_cell(x, y)`

Retrieves the content of a cell.

Parameters:

-   x (string|number): The x-coordinate of the cell.
-   y (string|number): The y-coordinate of the cell.

Returns the content of the cell, or `None` if the cell does not exist.

### `Table.set_cell(x, y, value)`

Set the content of a cell.

Parameters:

-   x (string|number): The x-coordinate of the cell.
-   y (string|number): The y-coordinate of the cell.
-   value (string|number|null|boolean): The value to set.

### `Table.to_csv()`

Converts the data object into CSV format.

Returns the table data in CSV format.

### `Table.to_list()`

Converts the table into a 2D list.

Returns the table as a 2D list.

### `Table.source`

The table's source object. This is the raw data that is stored under the table's document parent's `source.data`.

### `Table.label`

The table's label value. Can be used to set a `Table` instance's label. (`myTable.label = "myNewLabel"`)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jtf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "json, table, spreadsheet, fileformat, utility",
    "author": "Timothy Phillips",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d4/39/a6c5f598cdf709ee2ec632202367ca0b75af6f7233e6b54b8d191de9ce38/jtf-1.1.15.tar.gz",
    "platform": null,
    "description": "# jtf.py\n\nPython utilities for interacting with .jtf files.\n\n[View main repository.](https://github.com/NotTimTam/jtf)\n\n[Read the syntax standard.](https://github.com/NotTimTam/jtf/blob/main/SYNTAX.md)\n\n[View an example JTF file.](https://github.com/NotTimTam/jtf/blob/main/example.jtf)\n\nThis package is a direct conversion of the main JTF utilities. While the functions within this package use Python wording (like `list` instead of `array`), the casing required by the [JTF standard](https://github.com/NotTimTam/jtf/blob/main/SYNTAX.md) still applies when creating/parsing documents.\n\nRequires Python 3.12 or newer.\n\n# Installation\n\n```terminal\npip install jtf\n```\n\n# Usage\n\n```python\nfrom jtf import JTF\n\ndocument = JTF.parse(\"<document data>\")\n```\n\n# Reference\n\n## JTF Class\n\n### Import\n\n```python\nfrom jtf import JTF\n```\n\n### `JTF.target_list_includes_cell(target, x, y)`\n\nChecks if a target list targets a specific coordinate.\n\nParameters:\n\n-   target (List<number|string>): The target list to check.\n-   x (number|string): The x-coordinate to check.\n-   y (number|string): The y-coordinate to check.\n\nReturns `True` if the target list includes the specified coordinate, otherwise `False`.\n\n### `JTF.parse(data)`\n\nParses JTF data into a readable object.\n\nParameters:\n\n-   data (string|obj): The data to parse.\n\nReturns an instance of the `Document` class based on the parsed data.\n\n### `JTF.stringify(document)`\n\nConvert a [`Document`](#document-class) object into a string.\n\n-   document ([`Document`](#document-class)): The document to stringify.\n\nReturns a string of the document's source data.\n\n## Document Class\n\nGenerated by JTF class' [`parse`](#jtfparsedata) method.\n\n### `Document.get_cell(table, x, y)`\n\nRetrieves the content of a cell in a specified table.\n\nParameters:\n\n-   table: The index of the table.\n-   x: The x-coordinate of the cell.\n-   y: The y-coordinate of the cell.\n\nReturns the content of the cell, or `None` if the cell does not exist.\n\n### `Document.to_csv()`\n\nConverts each table in the document into CSV format.\n\nReturns an object containing CSV strings for each table in the document.\n\n### `Document.to_list()`\n\nConverts each table in the document into lists.\n\nReturns an object containing lists for each table in the document.\n\n### `Document.stringify()`\n\nReturns the data object represented by a JTF string.\n\n### `Document.update_updated_at()`\n\nUpdates the document's `updatedAt` value to be the current timestamp.\n\n### `Document.set_table(index, value)`\n\nSet a table to a value. **Will overwrite existing tables.**\n\nParameters:\n\n-   index (string|number): The index of the table.\n-   data: The data to set.\n\n### `Document.get_extra_processor_data(processor)`\n\nParameters:\n\n-   processor (string): The unique identifier the data is stored under.\n\nReturns a data object if found, or `None` if no object was found.\n\n### `Document.set_extra_processor_data(processor, data, extend)`\n\nOverwrites or updates data objects defined in a document's `metadata.extra` object.\n\nParameters:\n\n-   processor (string): The unique identifier the data is stored under.\n-   data (obj): An object of extra data to set.\n-   extend (boolean): If `True`, destructures the new data object into existing data instead of overwriting it. (default `False`)\n\n### `Document.tables`\n\nAn integer-string index of [`Table`](#table-class) objects.\n\n### `Document.source`\n\nThe document's source object. This is the raw data that is parsed in `JTF.parse()`.\n\n## Table Class\n\nGenerated by Document class and stored under `Document.tables` object.\n\n### `Table.get_cell_styles(x, y)`\n\nRetrieves the styles that must be applied to a cell.\n\nParameters:\n\n-   x (string|number): The x-coordinate of the cell.\n-   y (string|number): The y-coordinate of the cell.\n\nReturns an object containing the classes and styles to apply to this cell.\n\n### `Table.get_cell(x, y)`\n\nRetrieves the content of a cell.\n\nParameters:\n\n-   x (string|number): The x-coordinate of the cell.\n-   y (string|number): The y-coordinate of the cell.\n\nReturns the content of the cell, or `None` if the cell does not exist.\n\n### `Table.set_cell(x, y, value)`\n\nSet the content of a cell.\n\nParameters:\n\n-   x (string|number): The x-coordinate of the cell.\n-   y (string|number): The y-coordinate of the cell.\n-   value (string|number|null|boolean): The value to set.\n\n### `Table.to_csv()`\n\nConverts the data object into CSV format.\n\nReturns the table data in CSV format.\n\n### `Table.to_list()`\n\nConverts the table into a 2D list.\n\nReturns the table as a 2D list.\n\n### `Table.source`\n\nThe table's source object. This is the raw data that is stored under the table's document parent's `source.data`.\n\n### `Table.label`\n\nThe table's label value. Can be used to set a `Table` instance's label. (`myTable.label = \"myNewLabel\"`)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Tim Phillips  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Utilities for interacting with .jtf files.",
    "version": "1.1.15",
    "project_urls": {
        "Issues": "https://github.com/NotTimTam/jtf/issues",
        "Repository": "https://github.com/NotTimTam/jtf.py"
    },
    "split_keywords": [
        "json",
        " table",
        " spreadsheet",
        " fileformat",
        " utility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "865241d48dc6a5922d374f6a69c3a96916789ae10ea68e066608a9bc99319210",
                "md5": "58826520779ed45bc16724c2805dcbed",
                "sha256": "fd8b09d8e86d0376ebe05a2bc205efa15f756014984794e642be4688fcb19b38"
            },
            "downloads": -1,
            "filename": "jtf-1.1.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58826520779ed45bc16724c2805dcbed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 9435,
            "upload_time": "2024-08-19T16:17:32",
            "upload_time_iso_8601": "2024-08-19T16:17:32.979869Z",
            "url": "https://files.pythonhosted.org/packages/86/52/41d48dc6a5922d374f6a69c3a96916789ae10ea68e066608a9bc99319210/jtf-1.1.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d439a6c5f598cdf709ee2ec632202367ca0b75af6f7233e6b54b8d191de9ce38",
                "md5": "4a022ed5165753e36044dd3ead212465",
                "sha256": "faf9848d07d3e98310fd29bea3c5322b9dfd33fe7a2c131bf042b1bbed6c1372"
            },
            "downloads": -1,
            "filename": "jtf-1.1.15.tar.gz",
            "has_sig": false,
            "md5_digest": "4a022ed5165753e36044dd3ead212465",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 8545,
            "upload_time": "2024-08-19T16:17:34",
            "upload_time_iso_8601": "2024-08-19T16:17:34.260787Z",
            "url": "https://files.pythonhosted.org/packages/d4/39/a6c5f598cdf709ee2ec632202367ca0b75af6f7233e6b54b8d191de9ce38/jtf-1.1.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-19 16:17:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "NotTimTam",
    "github_project": "jtf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jtf"
}
        
Elapsed time: 0.52333s