ashfaquecodes


Nameashfaquecodes JSON
Version 0.7 PyPI version JSON
download
home_pagehttps://github.com/ashfaque/ashfaquecodes
SummaryCodes which can be used to increase productivity.
upload_time2024-01-28 10:32:30
maintainer
docs_urlNone
authorAshfaque Alam
requires_python
licenseGNU GPLv3
keywords ashfaque ashfaquecodes productivity
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![License: GNU GPLv3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/ashfaque/ashfaquecodes/blob/main/LICENSE)

## How to install
```sh
pip install ashfaquecodes
```

## Documentation
- Color the printed outputs in terminal.
    ```python
    from ashfaquecodes.ashfaquecodes import (
        , blue_print_start
        , red_print_start
        , green_print_start
        , color_print_reset
    )
    import pprint
    pp = pprint.PrettyPrinter(indent=4)
    # blue_print_start()
    red_print_start()
    # green_print_start()
    pp.pprint("--------------------------")
    color_print_reset()
    ```

- Get a unique list if list of non-unique elements passed in this function.
    ```python
    from ashfaquecodes.ashfaquecodes import unique_list
    _ = unique_list(non_unique_list)
    ```

- Get unique list of dictionaries if a list of duplicate dictionaries passed in this function.
    ```python
    from ashfaquecodes.ashfaquecodes import unique_list_of_dicts
    _ = unique_list_of_dicts(non_unique_list_of_dicts)
    ```

- Get a list of non-empty dictionaries if a list of empty and non-empty dictionaries passed in this function.
    ```python
    from ashfaquecodes.ashfaquecodes import remove_empty_dicts_from_list
    _ = remove_empty_dicts_from_list(list_with_empty_dicts)
    ```

- Get a sorted list of dictionaries returned according to your desired sorting key of the dictionary if a list of non-empty dictionaries passed in this function. Supports ascending and descending order.
    ```python
    from ashfaquecodes.ashfaquecodes import sort_list_of_dicts
    _ = sort_list_of_dicts(unsorted_list = unsorted_lst, key = 'dict_key_name', desc = True)
    ```

- Get execution time of your code. Can also prints the execution time in terminal if an optional parameter `print_time = True` is passed in the function.
    ```python
    from ashfaquecodes.ashfaquecodes import (
        get_execution_start_time
        , get_execution_end_time
    )
    execution_start_time = get_execution_start_time()
    total_execution_time_str = get_execution_end_time(execution_start_time, print_time = True)
    ```

- Custom Decorator to calculate execution time of a function which will be printed in the terminal during execution of that function.
    ```python
    from ashfaquecodes.ashfaquecodes import timer
    @timer
    def your_function(request):
        pass
    ```

- Custom `cprint()` function to print output in the terminal with different colors.
    ```python
    from ashfaquecodes.ashfaquecodes import cprint

    cprint('This is ' + 'a' + ' test print statement', color='red')
    cprint('This is an error message', color='green')
    cprint("Python : %2d, Portal : %5.2f" % (1, 05.333), color='yellow')
    cprint("Total students : %3d, Boys : %2d" % (240, 120), color='blue')
    cprint("%7.3o" % (25), color='magenta')
    cprint("%10.3E" % (356.08977), color='cyan')
    cprint('I love "{}!"'.format('Python'), color='white')
    cprint(f"I love {'Python'} \"{'Language'}!\"", color='red')

    data = dict(fun ="Python", adj ="Portal")
    cprint("I love {fun} computer {adj}".format(**data), color='red')

    cstr = "I love Python"
    # Printing the center aligned string with fillchr
    cprint("Center aligned string with fillchr: ", color='green')
    cprint(cstr.center(40, '#'), color='yellow')

    # cprinting the left aligned string with "-" padding
    cprint("The left aligned string is : ", color='blue')
    cprint(cstr.ljust(40, '-'), color='magenta')

    # cprinting the right aligned string with "-" padding
    cprint("The right aligned string is : ", color='cyan')
    cprint(cstr.rjust(40, '-'), color='white')
    ```

- Custom `cpprint` function to pprint output in the terminal with different colors and different formats.
    ```python
    from ashfaquecodes.ashfaquecodes import cpprint

    sample_data = {
        'key5': 'value1',
        'key2': 'value2',
        'key3': {
            'nested_key': 'nested_value',
            'nested_dict': {
                'deep_key': 'deep_value'
            }
        },
        'key4': [1, 2, 3, 4, 5],
        'key1': [
            {'name': 'John', 'age': 30},
            {'name': 'Alice', 'age': 25},
            {'name': 'Bob', 'age': 35}
        ]
    }

    cpprint(sample_data, indent = 4, color='green', width=80, depth=2, compact=False, sort_dicts=True)
    # Available colors: ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
    ```


## License
[GNU GPLv3](LICENSE)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ashfaque/ashfaquecodes",
    "name": "ashfaquecodes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ASHFAQUE,ASHFAQUECODES,PRODUCTIVITY",
    "author": "Ashfaque Alam",
    "author_email": "ashfaquealam496@yahoo.com",
    "download_url": "https://files.pythonhosted.org/packages/9b/88/881f6e7b40ab32e535dcaa1c344e21b431e5798473cc7399128e999db190/ashfaquecodes-0.7.tar.gz",
    "platform": null,
    "description": "[![License: GNU GPLv3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/ashfaque/ashfaquecodes/blob/main/LICENSE)\r\n\r\n## How to install\r\n```sh\r\npip install ashfaquecodes\r\n```\r\n\r\n## Documentation\r\n- Color the printed outputs in terminal.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import (\r\n        , blue_print_start\r\n        , red_print_start\r\n        , green_print_start\r\n        , color_print_reset\r\n    )\r\n    import pprint\r\n    pp = pprint.PrettyPrinter(indent=4)\r\n    # blue_print_start()\r\n    red_print_start()\r\n    # green_print_start()\r\n    pp.pprint(\"--------------------------\")\r\n    color_print_reset()\r\n    ```\r\n\r\n- Get a unique list if list of non-unique elements passed in this function.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import unique_list\r\n    _ = unique_list(non_unique_list)\r\n    ```\r\n\r\n- Get unique list of dictionaries if a list of duplicate dictionaries passed in this function.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import unique_list_of_dicts\r\n    _ = unique_list_of_dicts(non_unique_list_of_dicts)\r\n    ```\r\n\r\n- Get a list of non-empty dictionaries if a list of empty and non-empty dictionaries passed in this function.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import remove_empty_dicts_from_list\r\n    _ = remove_empty_dicts_from_list(list_with_empty_dicts)\r\n    ```\r\n\r\n- Get a sorted list of dictionaries returned according to your desired sorting key of the dictionary if a list of non-empty dictionaries passed in this function. Supports ascending and descending order.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import sort_list_of_dicts\r\n    _ = sort_list_of_dicts(unsorted_list = unsorted_lst, key = 'dict_key_name', desc = True)\r\n    ```\r\n\r\n- Get execution time of your code. Can also prints the execution time in terminal if an optional parameter `print_time = True` is passed in the function.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import (\r\n        get_execution_start_time\r\n        , get_execution_end_time\r\n    )\r\n    execution_start_time = get_execution_start_time()\r\n    total_execution_time_str = get_execution_end_time(execution_start_time, print_time = True)\r\n    ```\r\n\r\n- Custom Decorator to calculate execution time of a function which will be printed in the terminal during execution of that function.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import timer\r\n    @timer\r\n    def your_function(request):\r\n        pass\r\n    ```\r\n\r\n- Custom `cprint()` function to print output in the terminal with different colors.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import cprint\r\n\r\n    cprint('This is ' + 'a' + ' test print statement', color='red')\r\n    cprint('This is an error message', color='green')\r\n    cprint(\"Python : %2d, Portal : %5.2f\" % (1, 05.333), color='yellow')\r\n    cprint(\"Total students : %3d, Boys : %2d\" % (240, 120), color='blue')\r\n    cprint(\"%7.3o\" % (25), color='magenta')\r\n    cprint(\"%10.3E\" % (356.08977), color='cyan')\r\n    cprint('I love \"{}!\"'.format('Python'), color='white')\r\n    cprint(f\"I love {'Python'} \\\"{'Language'}!\\\"\", color='red')\r\n\r\n    data = dict(fun =\"Python\", adj =\"Portal\")\r\n    cprint(\"I love {fun} computer {adj}\".format(**data), color='red')\r\n\r\n    cstr = \"I love Python\"\r\n    # Printing the center aligned string with fillchr\r\n    cprint(\"Center aligned string with fillchr: \", color='green')\r\n    cprint(cstr.center(40, '#'), color='yellow')\r\n\r\n    # cprinting the left aligned string with \"-\" padding\r\n    cprint(\"The left aligned string is : \", color='blue')\r\n    cprint(cstr.ljust(40, '-'), color='magenta')\r\n\r\n    # cprinting the right aligned string with \"-\" padding\r\n    cprint(\"The right aligned string is : \", color='cyan')\r\n    cprint(cstr.rjust(40, '-'), color='white')\r\n    ```\r\n\r\n- Custom `cpprint` function to pprint output in the terminal with different colors and different formats.\r\n    ```python\r\n    from ashfaquecodes.ashfaquecodes import cpprint\r\n\r\n    sample_data = {\r\n        'key5': 'value1',\r\n        'key2': 'value2',\r\n        'key3': {\r\n            'nested_key': 'nested_value',\r\n            'nested_dict': {\r\n                'deep_key': 'deep_value'\r\n            }\r\n        },\r\n        'key4': [1, 2, 3, 4, 5],\r\n        'key1': [\r\n            {'name': 'John', 'age': 30},\r\n            {'name': 'Alice', 'age': 25},\r\n            {'name': 'Bob', 'age': 35}\r\n        ]\r\n    }\r\n\r\n    cpprint(sample_data, indent = 4, color='green', width=80, depth=2, compact=False, sort_dicts=True)\r\n    # Available colors: ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']\r\n    ```\r\n\r\n\r\n## License\r\n[GNU GPLv3](LICENSE)\r\n\r\n",
    "bugtrack_url": null,
    "license": "GNU GPLv3",
    "summary": "Codes which can be used to increase productivity.",
    "version": "0.7",
    "project_urls": {
        "Download": "https://github.com/ashfaque/ashfaquecodes/archive/refs/tags/v_07.tar.gz",
        "Homepage": "https://github.com/ashfaque/ashfaquecodes"
    },
    "split_keywords": [
        "ashfaque",
        "ashfaquecodes",
        "productivity"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b88881f6e7b40ab32e535dcaa1c344e21b431e5798473cc7399128e999db190",
                "md5": "2b30ccf19ec732201b33859cb6a74c1d",
                "sha256": "6e06ef56a4e0edaaf59d8438942002cad3698018108310a94c76f6b1d0ca346d"
            },
            "downloads": -1,
            "filename": "ashfaquecodes-0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "2b30ccf19ec732201b33859cb6a74c1d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19655,
            "upload_time": "2024-01-28T10:32:30",
            "upload_time_iso_8601": "2024-01-28T10:32:30.816032Z",
            "url": "https://files.pythonhosted.org/packages/9b/88/881f6e7b40ab32e535dcaa1c344e21b431e5798473cc7399128e999db190/ashfaquecodes-0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 10:32:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ashfaque",
    "github_project": "ashfaquecodes",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ashfaquecodes"
}
        
Elapsed time: 0.19812s