Name | seating JSON |
Version |
0.0.3
JSON |
| download |
home_page | |
Summary | Sort the order of class functions and properties |
upload_time | 2024-02-17 01:58:16 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.10 |
license | |
keywords |
alphabetical
order
sort
style
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# seating
Sort the order of class functions, properties, and member variables.
## Installation
Install with:
<pre>
pip install seating
</pre>
### Sorting and Priority
* Class variables declared in class body outside of a function
* Dunder methods
* Functions decorated with `property` or corresponding `.setter` and `.deleter` methods
* Class functions
Each of these groups will be sorted alphabetically with respect to themselves.
The only exception is for dunder methods.<br>
They will be sorted alphabetically except that `__init__` will be first.
If you have class contents that are grouped a certain way and you want the groups individually sorted
so that the grouping is maintained, you can use `# Seat` to demarcate the groups.
i.e. if the source is:
<pre>
class MyClass():
{arbitrary lines of code}
# Seat
{more arbitrary code}
# Seat
{yet more code}
</pre>
then the three sets of code in brackets will be sorted independently from one another.
## Usage
#### CLI
<pre>
>seat -h
usage: seat [-h] [--start START] [--stop STOP] [-nb] [-o OUTPUT] [-d] file
positional arguments:
file The file to format.
options:
-h, --help show this help message and exit
--start START Optional line number to start formatting at.
--stop STOP Optional line number to stop formatting at.
-nb, --noblack Don't format file with Black after sorting.
-o OUTPUT, --output OUTPUT
Write changes to this file, otherwise changes are written back to the original file.
-d, --dump Dump ast tree to file instead of doing anything else. For debugging purposes.
</pre>
#### Programmatically
<pre>
from seating import seat
from pathier import Pathier
file = Pathier("somefile.py")
source = file.read_text()
source = seat(source)
file.write_text(source)
</pre>
Raw data
{
"_id": null,
"home_page": "",
"name": "seating",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "alphabetical,order,sort,style",
"author": "",
"author_email": "Matt Manes <mattmanes@pm.me>",
"download_url": "https://files.pythonhosted.org/packages/6b/78/ce5a7ffecd4c4ac8f3190e1d9dfec30ff4d1c5128378286002e65e3df5c1/seating-0.0.3.tar.gz",
"platform": null,
"description": "# seating\n\nSort the order of class functions, properties, and member variables.\n\n## Installation\n\nInstall with:\n\n<pre>\npip install seating\n</pre>\n\n\n### Sorting and Priority\n\n* Class variables declared in class body outside of a function\n* Dunder methods\n* Functions decorated with `property` or corresponding `.setter` and `.deleter` methods\n* Class functions\n\nEach of these groups will be sorted alphabetically with respect to themselves.\n\nThe only exception is for dunder methods.<br>\nThey will be sorted alphabetically except that `__init__` will be first.\n\nIf you have class contents that are grouped a certain way and you want the groups individually sorted\nso that the grouping is maintained, you can use `# Seat` to demarcate the groups.\n\n\n\ni.e. if the source is:\n\n<pre>\nclass MyClass():\n {arbitrary lines of code}\n # Seat\n {more arbitrary code}\n # Seat\n {yet more code}\n</pre>\n\nthen the three sets of code in brackets will be sorted independently from one another.\n\n## Usage\n\n#### CLI\n\n<pre>\n>seat -h\nusage: seat [-h] [--start START] [--stop STOP] [-nb] [-o OUTPUT] [-d] file\n\npositional arguments:\n file The file to format.\n\noptions:\n -h, --help show this help message and exit\n --start START Optional line number to start formatting at.\n --stop STOP Optional line number to stop formatting at.\n -nb, --noblack Don't format file with Black after sorting.\n -o OUTPUT, --output OUTPUT\n Write changes to this file, otherwise changes are written back to the original file.\n -d, --dump Dump ast tree to file instead of doing anything else. For debugging purposes.\n</pre>\n\n#### Programmatically\n\n<pre>\nfrom seating import seat\nfrom pathier import Pathier\n\nfile = Pathier(\"somefile.py\")\nsource = file.read_text()\nsource = seat(source)\nfile.write_text(source)\n</pre>\n",
"bugtrack_url": null,
"license": "",
"summary": "Sort the order of class functions and properties",
"version": "0.0.3",
"project_urls": {
"Documentation": "https://github.com/matt-manes/seating/tree/main/docs",
"Homepage": "https://github.com/matt-manes/seating",
"Source code": "https://github.com/matt-manes/seating/tree/main/src/seating"
},
"split_keywords": [
"alphabetical",
"order",
"sort",
"style"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1ed5aa595ae4210fbf9738e2ceac618d955aad99b369432ba46b03edb27c040",
"md5": "855fb676c699cfa6d6ec3c86ea326e49",
"sha256": "5c5162bed9692abd5180fd9a7ef5568664036b639f214ef8becaccfcf36fc0b7"
},
"downloads": -1,
"filename": "seating-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "855fb676c699cfa6d6ec3c86ea326e49",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 6385,
"upload_time": "2024-02-17T01:58:15",
"upload_time_iso_8601": "2024-02-17T01:58:15.068123Z",
"url": "https://files.pythonhosted.org/packages/f1/ed/5aa595ae4210fbf9738e2ceac618d955aad99b369432ba46b03edb27c040/seating-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6b78ce5a7ffecd4c4ac8f3190e1d9dfec30ff4d1c5128378286002e65e3df5c1",
"md5": "9868709f2a22b71bf08b3c65dd70b6d2",
"sha256": "39898793f0da1a2025b8e81944b290306b469cc949764d3877be85cee251e120"
},
"downloads": -1,
"filename": "seating-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "9868709f2a22b71bf08b3c65dd70b6d2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5113,
"upload_time": "2024-02-17T01:58:16",
"upload_time_iso_8601": "2024-02-17T01:58:16.099490Z",
"url": "https://files.pythonhosted.org/packages/6b/78/ce5a7ffecd4c4ac8f3190e1d9dfec30ff4d1c5128378286002e65e3df5c1/seating-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-17 01:58:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "matt-manes",
"github_project": "seating",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "seating"
}