Skip to main content

A library that is used to remove print statements or converting quotes in python files (if present) in a folder

Project description

wrapup

This is a python library that will help you to remove print statements or convert the quotes of python files based on your given input. You have to input the path of the file or folder, and if the filepath is correct then the changes will be applied to all the python files in the folder or the file whose path was added.


IMPORTANT NOTES TO CONSIDER:

  1. In case if path of folder is passed as parameter, then the changes will be applied to all the python files (if possible) in the folder.
  2. No changes will be made to the python file, if by any chance removing print statement or converting the quotes leads to some syntactical errors.

To install the library, type in the command line: pip install wrapup

Import the package using: import wrapup

Usage:

  • To remove print statements from the files, use rmv_print function which takes the following arguments:

    1. filepath: The path of the file to be provided. The path can be relative or absolute. (If not provided; current working directory is considered)

    2. rmv_main: (default: False) Boolean value if True then, print statements should be removed from the main function main( ) or under
      if __name__ == "__main__":

    3. rmv_root: : (default: False) Boolean value if True then, print statements from level 0 indentations will be removed

    4. funcs_to_spare: Optional argument of list type that will ignore the functions specified in the list (not removing the print statements from the specified functions)

    Return value of the function is a list of path of python files to which changes were applied.




  • To convert single quotes to double quotes or vices versa, use convert_quotes function which takes the following arguments:

    1. filepath: The path of the file to be provided. The path can be relative or absolute. (If not provided; current working directory is considered)

    2. single: (default: True) Boolean value if True, convert all the quotes of the file to single quotes and to double quotes if False

      Return value of the function is a list of path of python files to which changes were applied.

    The below example will convert all the quotes of all the python files in the folder (subsequently in all sub-folders) to double quotes,

    from wrapup import convert_quotes
    convert_quotes(filepath="folder", single=False)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wrapup-1.0.1.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

wrapup-1.0.1-py3-none-any.whl (9.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page