The task is about writing your parser Formatted String Binding for CPE 2.3. The key thing about the project is the correctness of the inputted string CPE. I firmly focused on various validations including regex to test them within unit tests nextly. Moreover, even if the user provides an invalid string CPE, the error messages explain where exactly the problem lies and how the sample valid input looks.
In the case of launching an application through the terminal, the user will be provided with two choices.
- Write his own string CPE 2.3
- Use sample string CPE 2.3
The result will be visible in two places:
- Terminal
- DictCPE.json
Additional JSON file with proper indents is for increased readability purpose, which the terminal doesn't provide. It'll create after the execution of the main function.
# Sample input
stringCPE = cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*
# Desired output
output = {
"part": "a",
"vendor": "microsoft",
"product": "internet_explorer",
"version": "8.0.6001",
"update": "beta",
"edition": "ANY",
"language": "ANY",
"sw_edition": "ANY",
"target_sw": "ANY",
"target_hw": "ANY",
"other": "ANY"
}
These are the crucial steps to configuring and running the project. To clone and run this application, you'll need Git and Python (which comes with pip) installed on your computer.
# Clone this repository
$ git clone https://github.com/pawlovskiii/Parser-Formatted-String-Binding-For-CPE-2.3
# Go into the repository
$ cd Parser-Formatted-String-Binding-For-CPE-2.3
# To download all the necessary Python packages needed for the project
$ pip install -r requirements.txt
To run the project
$ python .\main.py
To run the tests within pytest
$ cd tests
$ pytest