docstringFormatter


NamedocstringFormatter JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryFormat docstring to be able to entry in DeepL or GoogleTranslate
upload_time2023-08-06 21:54:33
maintainer
docs_urlNone
author
requires_python>=3.7
licenseCopyright (c) 2023 Aoi Natsuki This software is released under the MIT. See below URL for details. <The MIT License> https://opensource.org/license/mit docstringFormatter
keywords docstringformatter docstring formatter deepl googletranslate delete remove indent newline tab space replace
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # docstringFormatter

Format docstring to be able to entry in DeepL or GoogleTranslate.

    Main function:
        1. Remove newline
        2. Reduce extra spaces
        3. Output result as txt-file

"docstringFormatter" releases you from boring duties to reform the docstring string in the Entry of DeepL or GoogleTranslate so that these get  correct translation.

# DEMO
Below show the console display when get docstring of `logging.Logger` object.  

____ _"[logging](https://docs.python.org/3/library/logging.html)" is one of the standard libraries of Python._  

Compared with "Original Sentence" section,  the strings of "Formatted Sentence"  is converted in one line by removing newlines and extra spaces that consist of indention of left side.  

Only the left thing you do is copy & paste the strings of "Formatted Sentence" in the Entry of Translating Web Application like DeepL or GoogleTranslate.  

```
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   Formatted Sentence   
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Instances of the Logger class represent a single logging channel. A "logging channel" indicates an area of an application. Exactly how an "area" is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of "input processing" might include sub-areas "read CSV files", "read XLS files" and "read Gnumeric files"). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Java or Python package namespace. So in the instance given above, channel names might be "input" for the upper level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels. There is no arbitrary limit to the depth of nesting. 

■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   Original Sentence   
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

    Instances of the Logger class represent a single logging channel. A
    "logging channel" indicates an area of an application. Exactly how an
    "area" is defined is up to the application developer. Since an
    application can have any number of areas, logging channels are identified
    by a unique string. Application areas can be nested (e.g. an area
    of "input processing" might include sub-areas "read CSV files", "read
    XLS files" and "read Gnumeric files"). To cater for this natural nesting,
    channel names are organized into a namespace hierarchy where levels are
    separated by periods, much like the Java or Python package namespace. So
    in the instance given above, channel names might be "input" for the upper
    level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
    There is no arbitrary limit to the depth of nesting.
    
```
 
# Features
1. Easy to Use  
__ You can use the function just adjust content of `main()` in code.
2. Easy to Read  
__ Console display is designated simply and reasonably.
3. Easy to Introduce  
__ Mainly 2ways to use are described in this README.  

# Requirement
 
"docstringFormatter" (ver.1.0.0) doesn't require third-party Library.
Probably, it works on over Python3.7.x Envelopment.

* Python 3.7.x
 
# Installation
 
Install "docstringFormatter" with pip command.
 
```bash
pip install docstringFormatter
```
 
# Usage
There are 2 way for usage.
One hand is (1) script running alone. Another is (2) import functions (or whole module).  

## (1) Run the "docstringFormatter.py" and use the main() in itself

Open the python file named "docstringFormatter.py" with any text editor and so on.  

Then change the assignment for var `name_object` in `main()` to the identifier of the object you want to get docstring.  

If you want the result as a txt-file, revalue the arguments of `txt_outputter()` appropriately.  

See the comments in the below code for details.

```python
def main():
    """
    You can try the function here.
    """

    # If the object requires import of module, you do so like the under example 'logging'
    import logging
    # Assign the identifier of object to 'name_object'
    name_object = logging.Logger
    # Default Setting at main() --> name_obj=name_object, times_red=2, rmv_t=True, rmv_n=True
    str_result = docstring_formatter(name_obj=name_object, times_red=2, rmv_t=True, rmv_n=True)

    console_constructor(str_result, name_object.__doc__)

    # If you need the output txt-file, revalue the 'output' arg to True.
    # You can change the output file name by rewriting 'filename' arg.
    txt_outputter(output=False, filename='docstring_formatted')

    # When you want the output is the same as 'Original Sentence' displayed on console,
    # revalue the arguments setting of docstring_formatter() like below.
    #
    # Setting at main() --> name_obj=name_object, times_red=0, rmv_t=False, rmv_n=False

```
## (2) Importing three functions by copy&paste contents of main()
Introducing to your code is also simple.  

First import at top in your cord.The example is shown below. 

And Just copy & paste the contents of `main()` to the appropriate line.  
Remember to delete the left side indent of pasted code.

```python
# import sentences example in case you'll copy & paste contents of main()
from src.docstringFormatter import docstring_formatter
from src.docstringFormatter import console_constructor
from src.docstringFormatter import txt_outputter
```
## Import as a module not multi functions
Sure, you can import this script as a module. If you can code, try it yourself!

# Note
 
I don't test the Environments under Linux and Mac.
 
# Author

* Auther: **Aoi Natsuki (蒼井 夏樹)**
* Work: [Blau Tine](https://sites.google.com/view/blau-tinte)
* E-mail: blautinte8`☆`gmail.com  
_- - - - - > Replace '☆' for '@'_
        

* Twitter ( or "X")
    <dl>
    <dt>Auther</dt>
     <dd><a href="https://twitter.com/Aoi_NatsuSolar">Aoi Natsuki(蒼井 夏樹)</a></dd>
     <dt>Workplace</dt>
     <dd><a href="https://twitter.com/BlauTinte">Blau Tinte</a></dd>
    </dl> 
* LinkedIn: [Aoi Natsuki](https://www.linkedin.com/in/aoi-natsuki)
 
# License
"docstringFormatter" is under [MIT license](https://opensource.org/license/mit).
  
  
  
  
  
  

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "docstringFormatter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Blau Tinte <blautinte8@gmail.com>",
    "keywords": "docstringFormatter,docstring,formatter,DeepL,GoogleTranslate,delete,remove,indent,newline,tab,space,replace",
    "author": "",
    "author_email": "Aoi Natsuki <blautinte8@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ec/78/67becf81a99fd4a00453311debf3169dba03079f957a3ad648d800cea8ab/docstringFormatter-1.0.0.tar.gz",
    "platform": null,
    "description": "# docstringFormatter\r\n\r\nFormat docstring to be able to entry in DeepL or GoogleTranslate.\r\n\r\n    Main function:\r\n        1. Remove newline\r\n        2. Reduce extra spaces\r\n        3. Output result as txt-file\r\n\r\n\"docstringFormatter\" releases you from boring duties to reform the docstring string in the Entry of DeepL or GoogleTranslate so that these get  correct translation.\r\n\r\n# DEMO\r\nBelow show the console display when get docstring of `logging.Logger` object.  \r\n\r\n____ _\"[logging](https://docs.python.org/3/library/logging.html)\" is one of the standard libraries of Python._  \r\n\r\nCompared with \"Original Sentence\" section,  the strings of \"Formatted Sentence\"  is converted in one line by removing newlines and extra spaces that consist of indention of left side.  \r\n\r\nOnly the left thing you do is copy & paste the strings of \"Formatted Sentence\" in the Entry of Translating Web Application like DeepL or GoogleTranslate.  \r\n\r\n```\r\n\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\r\n   Formatted Sentence   \r\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n Instances of the Logger class represent a single logging channel. A \"logging channel\" indicates an area of an application. Exactly how an \"area\" is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of \"input processing\" might include sub-areas \"read CSV files\", \"read XLS files\" and \"read Gnumeric files\"). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Java or Python package namespace. So in the instance given above, channel names might be \"input\" for the upper level, and \"input.csv\", \"input.xls\" and \"input.gnu\" for the sub-levels. There is no arbitrary limit to the depth of nesting. \r\n\r\n\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\u25a0\r\n   Original Sentence   \r\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\r\n    Instances of the Logger class represent a single logging channel. A\r\n    \"logging channel\" indicates an area of an application. Exactly how an\r\n    \"area\" is defined is up to the application developer. Since an\r\n    application can have any number of areas, logging channels are identified\r\n    by a unique string. Application areas can be nested (e.g. an area\r\n    of \"input processing\" might include sub-areas \"read CSV files\", \"read\r\n    XLS files\" and \"read Gnumeric files\"). To cater for this natural nesting,\r\n    channel names are organized into a namespace hierarchy where levels are\r\n    separated by periods, much like the Java or Python package namespace. So\r\n    in the instance given above, channel names might be \"input\" for the upper\r\n    level, and \"input.csv\", \"input.xls\" and \"input.gnu\" for the sub-levels.\r\n    There is no arbitrary limit to the depth of nesting.\r\n    \r\n```\r\n \r\n# Features\r\n1. Easy to Use  \r\n__ You can use the function just adjust content of `main()` in code.\r\n2. Easy to Read  \r\n__ Console display is designated simply and reasonably.\r\n3. Easy to Introduce  \r\n__ Mainly 2ways to use are described in this README.  \r\n\r\n# Requirement\r\n \r\n\"docstringFormatter\" (ver.1.0.0) doesn't require third-party Library.\r\nProbably, it works on over Python3.7.x Envelopment.\r\n\r\n* Python 3.7.x\r\n \r\n# Installation\r\n \r\nInstall \"docstringFormatter\" with pip command.\r\n \r\n```bash\r\npip install docstringFormatter\r\n```\r\n \r\n# Usage\r\nThere are 2 way for usage.\r\nOne hand is (1) script running alone. Another is (2) import functions (or whole module).  \r\n\r\n## (1) Run the \"docstringFormatter.py\" and use the main() in itself\r\n\r\nOpen the python file named \"docstringFormatter.py\" with any text editor and so on.  \r\n\r\nThen change the assignment for var `name_object` in `main()` to the identifier of the object you want to get docstring.  \r\n\r\nIf you want the result as a txt-file, revalue the arguments of `txt_outputter()` appropriately.  \r\n\r\nSee the comments in the below code for details.\r\n\r\n```python\r\ndef main():\r\n    \"\"\"\r\n    You can try the function here.\r\n    \"\"\"\r\n\r\n    # If the object requires import of module, you do so like the under example 'logging'\r\n    import logging\r\n    # Assign the identifier of object to 'name_object'\r\n    name_object = logging.Logger\r\n    # Default Setting at main() --> name_obj=name_object, times_red=2, rmv_t=True, rmv_n=True\r\n    str_result = docstring_formatter(name_obj=name_object, times_red=2, rmv_t=True, rmv_n=True)\r\n\r\n    console_constructor(str_result, name_object.__doc__)\r\n\r\n    # If you need the output txt-file, revalue the 'output' arg to True.\r\n    # You can change the output file name by rewriting 'filename' arg.\r\n    txt_outputter(output=False, filename='docstring_formatted')\r\n\r\n    # When you want the output is the same as 'Original Sentence' displayed on console,\r\n    # revalue the arguments setting of docstring_formatter() like below.\r\n    #\r\n    # Setting at main() --> name_obj=name_object, times_red=0, rmv_t=False, rmv_n=False\r\n\r\n```\r\n## (2) Importing three functions by copy&paste contents of main()\r\nIntroducing to your code is also simple.  \r\n\r\nFirst import at top in your cord.The example is shown below. \r\n\r\nAnd Just copy & paste the contents of `main()` to the appropriate line.  \r\nRemember to delete the left side indent of pasted code.\r\n\r\n```python\r\n# import sentences example in case you'll copy & paste contents of main()\r\nfrom src.docstringFormatter import docstring_formatter\r\nfrom src.docstringFormatter import console_constructor\r\nfrom src.docstringFormatter import txt_outputter\r\n```\r\n## Import as a module not multi functions\r\nSure, you can import this script as a module. If you can code, try it yourself!\r\n\r\n# Note\r\n \r\nI don't test the Environments under Linux and Mac.\r\n \r\n# Author\r\n\r\n* Auther: **Aoi Natsuki (\u84bc\u4e95 \u590f\u6a39)**\r\n* Work: [Blau Tine](https://sites.google.com/view/blau-tinte)\r\n* E-mail: blautinte8`\u2606`gmail.com  \r\n_- - - - - > Replace '\u2606' for '@'_\r\n        \r\n\r\n* Twitter ( or \"X\")\r\n    <dl>\r\n    <dt>Auther</dt>\r\n     <dd><a href=\"https://twitter.com/Aoi_NatsuSolar\">Aoi Natsuki(\u84bc\u4e95 \u590f\u6a39)</a></dd>\r\n     <dt>Workplace</dt>\r\n     <dd><a href=\"https://twitter.com/BlauTinte\">Blau Tinte</a></dd>\r\n    </dl> \r\n* LinkedIn: [Aoi Natsuki](https://www.linkedin.com/in/aoi-natsuki)\r\n \r\n# License\r\n\"docstringFormatter\" is under [MIT license](https://opensource.org/license/mit).\r\n  \r\n  \r\n  \r\n  \r\n  \r\n  \r\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2023 Aoi Natsuki  This software is released under the MIT. See below URL for details.  <The MIT License> https://opensource.org/license/mit  docstringFormatter",
    "summary": "Format docstring to be able to entry in DeepL or GoogleTranslate",
    "version": "1.0.0",
    "project_urls": {
        "Bug_Tracker": "https://github.com/NatsuSolar/docstringFormatter/issues",
        "Changelog": "https://github.com/NatsuSolar/docstringFormatter/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/NatsuSolar/docstringFormatter/blob/main/README.md",
        "Homepage": "https://github.com/NatsuSolar/docstringFormatter",
        "Repository": "https://github.com/NatsuSolar/docstringFormatter"
    },
    "split_keywords": [
        "docstringformatter",
        "docstring",
        "formatter",
        "deepl",
        "googletranslate",
        "delete",
        "remove",
        "indent",
        "newline",
        "tab",
        "space",
        "replace"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f9ccdb9e48a194e083300bd011b429f2a2d514482e7372e329d35ab88a479dc",
                "md5": "b9408951094f22adb1bef5fb72d95e7f",
                "sha256": "eaaf24b8587a9ea127442c0fc34f034775068daef77f87558ad83d1aaf15b54d"
            },
            "downloads": -1,
            "filename": "docstringFormatter-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9408951094f22adb1bef5fb72d95e7f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6497,
            "upload_time": "2023-08-06T21:54:32",
            "upload_time_iso_8601": "2023-08-06T21:54:32.567720Z",
            "url": "https://files.pythonhosted.org/packages/8f/9c/cdb9e48a194e083300bd011b429f2a2d514482e7372e329d35ab88a479dc/docstringFormatter-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec7867becf81a99fd4a00453311debf3169dba03079f957a3ad648d800cea8ab",
                "md5": "fe32892d935ab7fb67c796552cdef913",
                "sha256": "cbdef559826c3f65c34d6e033e6fbf033b82a9716733ef7abfd90ca1fa1eedf5"
            },
            "downloads": -1,
            "filename": "docstringFormatter-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fe32892d935ab7fb67c796552cdef913",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6459,
            "upload_time": "2023-08-06T21:54:33",
            "upload_time_iso_8601": "2023-08-06T21:54:33.817397Z",
            "url": "https://files.pythonhosted.org/packages/ec/78/67becf81a99fd4a00453311debf3169dba03079f957a3ad648d800cea8ab/docstringFormatter-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-06 21:54:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "NatsuSolar",
    "github_project": "docstringFormatter",
    "github_not_found": true,
    "lcname": "docstringformatter"
}
        
Elapsed time: 0.13309s