patched-codes / patchwork

Automate code reviews, patching and documentation with LLM workflows.
https://patched.codes
GNU Affero General Public License v3.0
164 stars 10 forks source link

Add config file in application directory #319

Closed CTY-git closed 2 weeks ago

patched-admin commented 2 weeks ago
In this set of code changes, a new import statement is added to include the 'get_user_config' function in the 'patchwork.common.utils.user_config' module, which retrieves the 'id' attribute to substitute for the generation of 'client_id'. Additionally, a new module is added that defines a UserConfig class with methods for reading and writing user configurations, inheriting from BaseModel and using pydantic for validation. The diff includes new imports for 'hashlib' and 'uuid' in the 'common/utils' directory, suggesting the use of hashing and UUID functionality. The code also adds a new configuration file named "config.json" and updates variable names for better readability. In test files, import statements are updated to align with actual module names for consistency. ------
* File changed: [patchwork/common/client/patched.py](https://github.com/patched-codes/patchwork/pull/319/files#diff-0998e5a615567a2c44e0de84a938c4d225e27ae97018e06f32775aa08db9a091) [In this patch, a new import statement is added to include the 'get_user_config' function from 'patchwork.common.utils.user_config'. This function is then called to retrieve the 'id' attribute that is used in place of generating 'client_id' using the SHA256 hash of the system's UUID.](https://github.com/patched-codes/patchwork/pull/319/files#diff-0998e5a615567a2c44e0de84a938c4d225e27ae97018e06f32775aa08db9a091)
* File changed: [patchwork/common/utils/user_config.py](https://github.com/patched-codes/patchwork/pull/319/files#diff-568fa22e3a3dbdce79fc68eeb0ebdf5114e69503c22db3c1733551c871e5726e) [The provided diff consists of a new module that defines a UserConfig class with a persist method and a get_user_config function for reading and writing user configurations to a specified file. The class inherits from BaseModel, uses pydantic for validation, and includes error logging within the persist and get_user_config methods.](https://github.com/patched-codes/patchwork/pull/319/files#diff-568fa22e3a3dbdce79fc68eeb0ebdf5114e69503c22db3c1733551c871e5726e)
* File changed: [patchwork/common/utils/utils.py](https://github.com/patched-codes/patchwork/pull/319/files#diff-f3466dc43f091cee836042d9954f12a719cf38d5ede82bd0ad66fd68095f0ab3) [The diff adds two new imports, `hashlib` and `uuid`, to the `utils.py` file in the `common/utils` directory. This suggests that hashing and UUID functionality may be used within this module for various purposes.](https://github.com/patched-codes/patchwork/pull/319/files#diff-f3466dc43f091cee836042d9954f12a719cf38d5ede82bd0ad66fd68095f0ab3)
* File changed: [patchwork/managed_files.py](https://github.com/patched-codes/patchwork/pull/319/files#diff-34bd065478f0d971ea5a387732b9fa23c75985273a80b4bc0546b30dce9fa4d9) [The diff in the code adds a new configuration file named "config.json" to be stored in the HOME_FOLDER directory alongside the existing "patched.log" log file. The variable names have been updated to use double underscores for better readability.](https://github.com/patched-codes/patchwork/pull/319/files#diff-34bd065478f0d971ea5a387732b9fa23c75985273a80b4bc0546b30dce9fa4d9)
* File changed: [tests/steps/test_CallAPI.py](https://github.com/patched-codes/patchwork/pull/319/files#diff-c46e9dd1f6b159f8daf0772e63a5d40b86750e6a29788db3d13720150e653df1) [In the file `test_CallAPI.py`, the import statement for the `CallAPI` class was updated to remove a commented placeholder and align with the actual module name.](https://github.com/patched-codes/patchwork/pull/319/files#diff-c46e9dd1f6b159f8daf0772e63a5d40b86750e6a29788db3d13720150e653df1)
* File changed: [tests/steps/test_SlackMessage.py](https://github.com/patched-codes/patchwork/pull/319/files#diff-8376b3ee47dbdcae872a4909cd5e0ccc522619f02339f1ed77d0591f7363c88b) [The diff in the test_SlackMessage.py file involves changing the import statement to use the actual module name SlackMessage instead of a placeholder, indicating a more specific import.](https://github.com/patched-codes/patchwork/pull/319/files#diff-8376b3ee47dbdcae872a4909cd5e0ccc522619f02339f1ed77d0591f7363c88b)