sk-variable-handler


Namesk-variable-handler JSON
Version 1.0.102 PyPI version JSON
download
home_page
SummaryA simple Variable Handling program
upload_time2023-08-01 17:22:44
maintainer
docs_urlNone
authorgkibria
requires_python>=3.6
license
keywords python report generator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Variable Handler

This is a Python package that provides a `VariableHandler` class for extracting variable values from a string of variable declarations.

## Installation

To use the `VariableHandler` package, you need to install it first. You can install it using pip:

```shell
pip install sk_variable_handler
```

## Usage

To extract variable values from a string of variable declarations, follow these steps:

1. Import the `VariableHandler` class from the `variable_handler` module:

   ```python
   from sk_variable_handler import VariableHandler
   ```

2. Create an instance of the `VariableHandler` class:

   ```python
   variable_handler = VariableHandler()
   ```

3. Call the `get_values` method of the `VariableHandler` instance, passing the string of variable declarations as an argument. It returns a dictionary containing the variable names as keys and their corresponding values as values.

   ```python
   declarations = "Your variable declarations"
   values = variable_handler.get_values(declarations)
   ```

### Example

Here is an example that demonstrates the usage of the `VariableHandler`:

```python
from variable_handler import VariableHandler

variable_handler = VariableHandler()

declarations = "$x=1+2;$y=2+1;$var=12+223+(222+2)+sin(90);$var2=$x+$y;$xy=($var2+$x+$y);$yx=$xy+$var2"
expected_result = {'$x': '3.0', '$y': '3.0', '$var': '460.0', '$var2': '6.0', '$xy': '12.0', '$yx': '18.0'}

result = variable_handler.get_values(declarations)
assert result == expected_result
```

## Test Cases

The package includes a set of unit tests to verify the functionality of the `VariableHandler` class. The tests cover various scenarios and edge cases to ensure the correct extraction of variable values.

To run the tests, execute the script as a standalone Python program:

```shell
python <filename>.py
```

The output will indicate whether all the tests have passed or if there are any failures.

Please note that the tests are implemented using the `unittest` framework. Each test case is independent and tests a specific aspect of the `VariableHandler` functionality.

## Contributing

Contributions to the `VariableHandler` package are welcome! If you encounter any issues, have suggestions for improvements, or would like to add new features, please create a pull request or open an issue on the GitHub repository.

## License

The `VariableHandler` package is distributed under the [MIT License](https://opensource.org/licenses/MIT). See the [LICENSE](LICENSE) file for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "sk-variable-handler",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "python,report generator",
    "author": "gkibria",
    "author_email": "gkibria121@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/38/15/bf85647ae31063949a36884a9ef6d18948f1e0e9625b2ebfd97a10f66ef2/sk_variable_handler-1.0.102.tar.gz",
    "platform": null,
    "description": "# Variable Handler\r\n\r\nThis is a Python package that provides a `VariableHandler` class for extracting variable values from a string of variable declarations.\r\n\r\n## Installation\r\n\r\nTo use the `VariableHandler` package, you need to install it first. You can install it using pip:\r\n\r\n```shell\r\npip install sk_variable_handler\r\n```\r\n\r\n## Usage\r\n\r\nTo extract variable values from a string of variable declarations, follow these steps:\r\n\r\n1. Import the `VariableHandler` class from the `variable_handler` module:\r\n\r\n   ```python\r\n   from sk_variable_handler import VariableHandler\r\n   ```\r\n\r\n2. Create an instance of the `VariableHandler` class:\r\n\r\n   ```python\r\n   variable_handler = VariableHandler()\r\n   ```\r\n\r\n3. Call the `get_values` method of the `VariableHandler` instance, passing the string of variable declarations as an argument. It returns a dictionary containing the variable names as keys and their corresponding values as values.\r\n\r\n   ```python\r\n   declarations = \"Your variable declarations\"\r\n   values = variable_handler.get_values(declarations)\r\n   ```\r\n\r\n### Example\r\n\r\nHere is an example that demonstrates the usage of the `VariableHandler`:\r\n\r\n```python\r\nfrom variable_handler import VariableHandler\r\n\r\nvariable_handler = VariableHandler()\r\n\r\ndeclarations = \"$x=1+2;$y=2+1;$var=12+223+(222+2)+sin(90);$var2=$x+$y;$xy=($var2+$x+$y);$yx=$xy+$var2\"\r\nexpected_result = {'$x': '3.0', '$y': '3.0', '$var': '460.0', '$var2': '6.0', '$xy': '12.0', '$yx': '18.0'}\r\n\r\nresult = variable_handler.get_values(declarations)\r\nassert result == expected_result\r\n```\r\n\r\n## Test Cases\r\n\r\nThe package includes a set of unit tests to verify the functionality of the `VariableHandler` class. The tests cover various scenarios and edge cases to ensure the correct extraction of variable values.\r\n\r\nTo run the tests, execute the script as a standalone Python program:\r\n\r\n```shell\r\npython <filename>.py\r\n```\r\n\r\nThe output will indicate whether all the tests have passed or if there are any failures.\r\n\r\nPlease note that the tests are implemented using the `unittest` framework. Each test case is independent and tests a specific aspect of the `VariableHandler` functionality.\r\n\r\n## Contributing\r\n\r\nContributions to the `VariableHandler` package are welcome! If you encounter any issues, have suggestions for improvements, or would like to add new features, please create a pull request or open an issue on the GitHub repository.\r\n\r\n## License\r\n\r\nThe `VariableHandler` package is distributed under the [MIT License](https://opensource.org/licenses/MIT). See the [LICENSE](LICENSE) file for more information.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple Variable Handling  program",
    "version": "1.0.102",
    "project_urls": null,
    "split_keywords": [
        "python",
        "report generator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3dffc51dc45b9ac349e984f0f8c6e44e8257db9e8829d3ada2ae68cbec5e020d",
                "md5": "08849dc91baf509b3747ea86252af751",
                "sha256": "48ec010df40c914113263ea65c7a1d07e3db3858084993b50cb86fe8272a738d"
            },
            "downloads": -1,
            "filename": "sk_variable_handler-1.0.102-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08849dc91baf509b3747ea86252af751",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4512,
            "upload_time": "2023-08-01T17:22:41",
            "upload_time_iso_8601": "2023-08-01T17:22:41.094047Z",
            "url": "https://files.pythonhosted.org/packages/3d/ff/c51dc45b9ac349e984f0f8c6e44e8257db9e8829d3ada2ae68cbec5e020d/sk_variable_handler-1.0.102-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3815bf85647ae31063949a36884a9ef6d18948f1e0e9625b2ebfd97a10f66ef2",
                "md5": "cc9383161f3d66f1231068f2d507f41b",
                "sha256": "7015d6c39b5d19d8dd3968feb41ce1a8685bc60f3b5e056b142424d52ecbb406"
            },
            "downloads": -1,
            "filename": "sk_variable_handler-1.0.102.tar.gz",
            "has_sig": false,
            "md5_digest": "cc9383161f3d66f1231068f2d507f41b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4100,
            "upload_time": "2023-08-01T17:22:44",
            "upload_time_iso_8601": "2023-08-01T17:22:44.312320Z",
            "url": "https://files.pythonhosted.org/packages/38/15/bf85647ae31063949a36884a9ef6d18948f1e0e9625b2ebfd97a10f66ef2/sk_variable_handler-1.0.102.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-01 17:22:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sk-variable-handler"
}
        
Elapsed time: 2.56134s