pypolish


Namepypolish JSON
Version 0.0.7 PyPI version JSON
download
home_page
SummaryEasily Polish Structured Data
upload_time2023-04-06 01:53:09
maintainer
docs_urlNone
authorHunter Thomas
requires_python
licenseMIT
keywords polish data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Function: polish_file(input_file, output_file, exceptions='')

This function takes in an input file and an output file, both with supported file extensions (.csv, .json, or .txt), and an optional list of exceptions.

## Parameters
- `input_file` (`str`): The path to the input file to be polished.
- `output_file` (`str`): The path to the output file to be written with the polished data.
- `exceptions` (`str`, optional): An optional string of characters to be excluded from the polishing process.

## Returns
- `None`

## Raises
- `Exception`: If the input and output files do not have the same supported file extension.
- `Exception`: If the file format is not supported.

## Supported file extensions
- `.csv`: Comma-separated values file
- `.json`: JavaScript Object Notation file
- `.txt`: Text file

## Description
This function cleans the input file by removing impurities, such as special characters, except for those included in the optional exceptions list. The cleaned data is then written to the output file with the same format as the input file.

**Note:** This function does not check if the input file exists or if the output file can be written to. It is the responsibility of the calling code to ensure that the necessary file permissions and file paths are valid.

```python
# Import the function
from pypolish import polish

# Define the input and output files
input_file = "data/input.json"
output_file = "data/output.json"

# Define any exceptions to the cleaning process
exceptions = ['(', '.', '@']


polish.polish_file(input_file, output_file, exceptions)

# Check the output file to see if the cleaning process was successful
with open(output_file, 'r') as f:
    print(f.read())
```

##Github Repo
https://github.com/huntert1004/pypolish

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pypolish",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Polish data",
    "author": "Hunter Thomas",
    "author_email": "waidai2027@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/09/fb/1023d80031ae28a76711778d55d51e5e3df1eafd68692bc5aefe12392753/pypolish-0.0.7.tar.gz",
    "platform": null,
    "description": "# Function: polish_file(input_file, output_file, exceptions='')\r\n\r\nThis function takes in an input file and an output file, both with supported file extensions (.csv, .json, or .txt), and an optional list of exceptions.\r\n\r\n## Parameters\r\n- `input_file` (`str`): The path to the input file to be polished.\r\n- `output_file` (`str`): The path to the output file to be written with the polished data.\r\n- `exceptions` (`str`, optional): An optional string of characters to be excluded from the polishing process.\r\n\r\n## Returns\r\n- `None`\r\n\r\n## Raises\r\n- `Exception`: If the input and output files do not have the same supported file extension.\r\n- `Exception`: If the file format is not supported.\r\n\r\n## Supported file extensions\r\n- `.csv`: Comma-separated values file\r\n- `.json`: JavaScript Object Notation file\r\n- `.txt`: Text file\r\n\r\n## Description\r\nThis function cleans the input file by removing impurities, such as special characters, except for those included in the optional exceptions list. The cleaned data is then written to the output file with the same format as the input file.\r\n\r\n**Note:** This function does not check if the input file exists or if the output file can be written to. It is the responsibility of the calling code to ensure that the necessary file permissions and file paths are valid.\r\n\r\n```python\r\n# Import the function\r\nfrom pypolish import polish\r\n\r\n# Define the input and output files\r\ninput_file = \"data/input.json\"\r\noutput_file = \"data/output.json\"\r\n\r\n# Define any exceptions to the cleaning process\r\nexceptions = ['(', '.', '@']\r\n\r\n\r\npolish.polish_file(input_file, output_file, exceptions)\r\n\r\n# Check the output file to see if the cleaning process was successful\r\nwith open(output_file, 'r') as f:\r\n    print(f.read())\r\n```\r\n\r\n##Github Repo\r\nhttps://github.com/huntert1004/pypolish\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easily Polish Structured Data",
    "version": "0.0.7",
    "split_keywords": [
        "polish",
        "data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09fb1023d80031ae28a76711778d55d51e5e3df1eafd68692bc5aefe12392753",
                "md5": "8b599d91e206f2f29008572679c96855",
                "sha256": "e10c11437e8133fa6c6bf945074344fc81ba183f13646e1b5b6029fd48835e1d"
            },
            "downloads": -1,
            "filename": "pypolish-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "8b599d91e206f2f29008572679c96855",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3917,
            "upload_time": "2023-04-06T01:53:09",
            "upload_time_iso_8601": "2023-04-06T01:53:09.354510Z",
            "url": "https://files.pythonhosted.org/packages/09/fb/1023d80031ae28a76711778d55d51e5e3df1eafd68692bc5aefe12392753/pypolish-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-06 01:53:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pypolish"
}
        
Elapsed time: 0.05059s