cowexcept


Namecowexcept JSON
Version 1.3.1 PyPI version JSON
download
home_page
SummarySpice up those exceptions with cowexcept!
upload_time2023-06-16 07:18:43
maintainer
docs_urlNone
authorJames Finnie-Ansley
requires_python>=3.8
licenseMIT License Copyright (c) 2021 James Finnie-Ansley 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 cowsay
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CowExcept

Spice up those exceptions with cowexcept!

     ______________________________________ 
    < NameError: name 'baz' is not defined >
     -------------------------------------- 
         \   ^__^
          \  (oo)\_______
             (__)\       )\/\
                 ||----w |
                 ||     ||

## Install

    pip install cowexcept

## Usage

All you have to do to get started is activate `cowexcept` and then any
exceptions whenceforth will be in beautiful cowsay format:

    >>> import cowexcept
    >>> cowexcept.activate()
    >>> 1/0
     _____________________________________ 
    / Traceback (most recent call last):  \
    |   File "...", line 1, in ...        |
    |     1 / 0                           |
    \ ZeroDivisionError: division by zero /
     ------------------------------------- 
            \   ^__^
             \  (oo)\_______
                (__)\       )\/\
                    ||----w |
                    ||     ||

The `cowexcept.activate()` call is to avoid unused import flags from IDEs or
style checkers and avoiding any import-time side effects. If unused imports and
import-time side effects do not bother you, and you would prefer to avoid the
horrible extra line used to explicitly activate `cowexcept`,
use `import cowexcept.auto` instead and this will activate `cowexcept` on
import.

To deactivate `cowexcept` call `cowexcept.deactivate()` and any exceptions will
be handled as before.

### Using Your Own Cows

You can specify alternative cows to display using the `set_cow`
and `set_cow_from_file` functions.

The `set_cow` function takes the name of any cowfile included in
the [python-cowsay](https://github.com/James-Ansley/cowsay) package and sets the
cow to be displayed in exceptions.

    >>> import cowexcept
    >>> cowexcept.activate()
    >>> cowexcept.set_cow("dragon-and-cow")
    >>> 1 / 0
     _____________________________________ 
    / Traceback (most recent call last):  \
    |   File "...", line 1, in ...        |
    |     1 / 0                           |
    \ ZeroDivisionError: division by zero /
     -------------------------------------
                           \                    ^    /^
                            \                  / \  // \
                             \   |\___/|      /   \//  .\
                              \  /O  O  \__  /    //  | \ \           *----*
                                /     /  \/_/    //   |  \  \          \   |
                                @___@`    \/_   //    |   \   \         \/\ \
                               0/0/|       \/_ //     |    \    \         \  \
                           0/0/0/0/|        \///      |     \     \       |  |
                        0/0/0/0/0/_|_ /   (  //       |      \     _\     |  /
                     0/0/0/0/0/0/`/,_ _ _/  ) ; -.    |    _ _\.-~       /   /
                                 ,-}        _      *-.|.-~-.           .~    ~
                \     \__/        `/\      /                 ~-. _ .-~      /
                 \____(oo)           *.   }            {                   /
                 (    (--)          .----~-.\        \-`                 .~
                 //__\\  \__ Ack!   ///.----..<        \             _ -~
                //    \\               ///-._ _ _ _ _ _ _{^ - - - - ~


You can also specify custom cows by passing in a cowfile or TextIO stream to
the `set_cow_from_file` function:

    >>> from io import StringIO
    >>> import cowexcept
    >>> cowexcept.set_cow_from_file(StringIO("""
    ... $the_cow = <<EOC;
    ...          $thoughts
    ...           $thoughts
    ...            ___
    ...           (o o)
    ...          (  V  )
    ...         /--m-m-
    ... EOC
    ... """))
    >>> cowexcept.activate()
    >>> 1 / 0
     _____________________________________ 
    / Traceback (most recent call last):  \
    |   File "...", line 1, in ...        |
    |     1 / 0                           |
    \ ZeroDivisionError: division by zero /
     -------------------------------------
             \
              \
               ___
              (o o)
             (  V  )
            /--m-m-

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cowexcept",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "cowsay",
    "author": "James Finnie-Ansley",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/71/22/d7ade9feed2b94cdf7cc3aabdbf9d4f232b34cb28cc24a3506c5077a12b5/cowexcept-1.3.1.tar.gz",
    "platform": null,
    "description": "# CowExcept\n\nSpice up those exceptions with cowexcept!\n\n     ______________________________________ \n    < NameError: name 'baz' is not defined >\n     -------------------------------------- \n         \\   ^__^\n          \\  (oo)\\_______\n             (__)\\       )\\/\\\n                 ||----w |\n                 ||     ||\n\n## Install\n\n    pip install cowexcept\n\n## Usage\n\nAll you have to do to get started is activate `cowexcept` and then any\nexceptions whenceforth will be in beautiful cowsay format:\n\n    >>> import cowexcept\n    >>> cowexcept.activate()\n    >>> 1/0\n     _____________________________________ \n    / Traceback (most recent call last):  \\\n    |   File \"...\", line 1, in ...        |\n    |     1 / 0                           |\n    \\ ZeroDivisionError: division by zero /\n     ------------------------------------- \n            \\   ^__^\n             \\  (oo)\\_______\n                (__)\\       )\\/\\\n                    ||----w |\n                    ||     ||\n\nThe `cowexcept.activate()` call is to avoid unused import flags from IDEs or\nstyle checkers and avoiding any import-time side effects. If unused imports and\nimport-time side effects do not bother you, and you would prefer to avoid the\nhorrible extra line used to explicitly activate `cowexcept`,\nuse `import cowexcept.auto` instead and this will activate `cowexcept` on\nimport.\n\nTo deactivate `cowexcept` call `cowexcept.deactivate()` and any exceptions will\nbe handled as before.\n\n### Using Your Own Cows\n\nYou can specify alternative cows to display using the `set_cow`\nand `set_cow_from_file` functions.\n\nThe `set_cow` function takes the name of any cowfile included in\nthe [python-cowsay](https://github.com/James-Ansley/cowsay) package and sets the\ncow to be displayed in exceptions.\n\n    >>> import cowexcept\n    >>> cowexcept.activate()\n    >>> cowexcept.set_cow(\"dragon-and-cow\")\n    >>> 1 / 0\n     _____________________________________ \n    / Traceback (most recent call last):  \\\n    |   File \"...\", line 1, in ...        |\n    |     1 / 0                           |\n    \\ ZeroDivisionError: division by zero /\n     -------------------------------------\n                           \\                    ^    /^\n                            \\                  / \\  // \\\n                             \\   |\\___/|      /   \\//  .\\\n                              \\  /O  O  \\__  /    //  | \\ \\           *----*\n                                /     /  \\/_/    //   |  \\  \\          \\   |\n                                @___@`    \\/_   //    |   \\   \\         \\/\\ \\\n                               0/0/|       \\/_ //     |    \\    \\         \\  \\\n                           0/0/0/0/|        \\///      |     \\     \\       |  |\n                        0/0/0/0/0/_|_ /   (  //       |      \\     _\\     |  /\n                     0/0/0/0/0/0/`/,_ _ _/  ) ; -.    |    _ _\\.-~       /   /\n                                 ,-}        _      *-.|.-~-.           .~    ~\n                \\     \\__/        `/\\      /                 ~-. _ .-~      /\n                 \\____(oo)           *.   }            {                   /\n                 (    (--)          .----~-.\\        \\-`                 .~\n                 //__\\\\  \\__ Ack!   ///.----..<        \\             _ -~\n                //    \\\\               ///-._ _ _ _ _ _ _{^ - - - - ~\n\n\nYou can also specify custom cows by passing in a cowfile or TextIO stream to\nthe `set_cow_from_file` function:\n\n    >>> from io import StringIO\n    >>> import cowexcept\n    >>> cowexcept.set_cow_from_file(StringIO(\"\"\"\n    ... $the_cow = <<EOC;\n    ...          $thoughts\n    ...           $thoughts\n    ...            ___\n    ...           (o o)\n    ...          (  V  )\n    ...         /--m-m-\n    ... EOC\n    ... \"\"\"))\n    >>> cowexcept.activate()\n    >>> 1 / 0\n     _____________________________________ \n    / Traceback (most recent call last):  \\\n    |   File \"...\", line 1, in ...        |\n    |     1 / 0                           |\n    \\ ZeroDivisionError: division by zero /\n     -------------------------------------\n             \\\n              \\\n               ___\n              (o o)\n             (  V  )\n            /--m-m-\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 James Finnie-Ansley  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": "Spice up those exceptions with cowexcept!",
    "version": "1.3.1",
    "project_urls": {
        "repository": "https://github.com/James-Ansley/cowexcept"
    },
    "split_keywords": [
        "cowsay"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9fefecb77ca43bd389fffc57423bf03870299716e138244891df9a7e9d1f1f5a",
                "md5": "c71202bf3f985f2dd2ad6beacec6c3bd",
                "sha256": "8c9471f698f6751de9caeb96c36c09abf634998d0f69c8121c9bd443354fe7cd"
            },
            "downloads": -1,
            "filename": "cowexcept-1.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c71202bf3f985f2dd2ad6beacec6c3bd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4809,
            "upload_time": "2023-06-16T07:18:42",
            "upload_time_iso_8601": "2023-06-16T07:18:42.469390Z",
            "url": "https://files.pythonhosted.org/packages/9f/ef/ecb77ca43bd389fffc57423bf03870299716e138244891df9a7e9d1f1f5a/cowexcept-1.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7122d7ade9feed2b94cdf7cc3aabdbf9d4f232b34cb28cc24a3506c5077a12b5",
                "md5": "3176b9ab8f5f29632ab1fdeb43dde2b1",
                "sha256": "897b6de11ef778d4aebff4bc6b15b5e2577037627879a19bf7facb72ceb8b3ce"
            },
            "downloads": -1,
            "filename": "cowexcept-1.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3176b9ab8f5f29632ab1fdeb43dde2b1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4171,
            "upload_time": "2023-06-16T07:18:43",
            "upload_time_iso_8601": "2023-06-16T07:18:43.967661Z",
            "url": "https://files.pythonhosted.org/packages/71/22/d7ade9feed2b94cdf7cc3aabdbf9d4f232b34cb28cc24a3506c5077a12b5/cowexcept-1.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-16 07:18:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "James-Ansley",
    "github_project": "cowexcept",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cowexcept"
}
        
Elapsed time: 0.20404s