You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

diff-parser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff-parser

Parse git diff data or .diff file. Access a list of properties including filenames, filepath, source-hash, target-hash and more for every file changed.

1.1
pipPyPI
Maintainers
1

diff-parser

diff-parser is a Python package for parsing and representing diff files.

Parse a git diff data or .diff file. Access a list of properties including filenames, filepath, source-hash, target-hash and more for every file changed.

Installation

You can install diff-parser using pip:

pip install diff-parser

Usage

To use diff-parser, simply import the required modules and classes:

from diff_parser import Diff

# Example usage:
diff = Diff("path/to/diff/file.diff")
for block in diff:
    print(block.new_filename) # main.py
    print(block.new_filepath) # /path/to/main.py
    print(block.old_filename) # main.py
    print(block.old_filepath) # /path/to/main.py
    print(block.source_hash)  # abcdef
    print(block.target_hash)  # uvwxyz
    print(block.type)         # modified
    print(block.content)      # None (to be implemented)

Contributing

Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

diff

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts