patched-codes / patchwork

Automate code reviews, patching and documentation with self-hosted LLM workflows.
https://patched.codes
GNU Affero General Public License v3.0
965 stars 59 forks source link

Add path metadata #340

Closed CTY-git closed 3 months ago

patched-admin commented 3 months ago
In various Python files within the patchwork project, import statements have been updated from 'types' to 'typing' or from 'utils.types' to 'utils.typing' to reflect the correct module being used. Additionally, constants like IS_CONFIG have been imported from 'typing' instead of 'types' in some files, and new constant variables like IS_PATH have been added to the typing.py file. Modifications were made to functions within the user_config.py and typed.py files, including changes in type annotations and error handling.Overall, the changes in these code descriptions involve adjusting import statements and variable definitions to ensure consistency and accuracy within the patchwork project. ------
* File changed: [patchwork/common/utils/typing.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-449b7f8e86a6d8b94aa124f1112521dd3427e0b519fe6b96ef7e61bfffe9ed74) [A new constant variable IS_PATH has been added to the file typing.py in addition to the existing IS_CONFIG constant variable.](https://github.com/patched-codes/patchwork/pull/340/files#diff-449b7f8e86a6d8b94aa124f1112521dd3427e0b519fe6b96ef7e61bfffe9ed74)
* File changed: [patchwork/common/utils/user_config.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-568fa22e3a3dbdce79fc68eeb0ebdf5114e69503c22db3c1733551c871e5726e) [The change in the diff modifies the 'get_user_config' function in the user_config.py file to use 'model_validate_json' method instead of 'model_validate_strings' when reading the text from the CONFIG_FILE, in case of an exception, an error message is logged.](https://github.com/patched-codes/patchwork/pull/340/files#diff-568fa22e3a3dbdce79fc68eeb0ebdf5114e69503c22db3c1733551c871e5726e)
* File changed: [patchwork/steps/CallAPI/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-8fa197c3ad1cfd5d1075cbc9d1521c9895ea4b31f374d1ec6a29c2afe6ac1272) [The diff shows a change in the import statement from "patchwork.common.utils.types" to "patchwork.common.utils.typing" in the "CallAPI/typed.py" file.](https://github.com/patched-codes/patchwork/pull/340/files#diff-8fa197c3ad1cfd5d1075cbc9d1521c9895ea4b31f374d1ec6a29c2afe6ac1272)
* File changed: [patchwork/steps/CallCode2Prompt/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-3fa21a47891c507393238ccbcdbb3a01453431426de50b7ccce7423e135f20cc) [The import statement in the file typed.py is updated to include IS_PATH from patchwork.common.utils.typing.py. Additionally, the definition of the folder_path attribute within the class CallCode2PromptRequiredInputs is changed to include the IS_PATH type annotation in addition to IS_CONFIG.](https://github.com/patched-codes/patchwork/pull/340/files#diff-3fa21a47891c507393238ccbcdbb3a01453431426de50b7ccce7423e135f20cc)
* File changed: [patchwork/steps/CallLLM/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-7eee5f695e6a689150f65f01187311311ea8560450c433ec8637b6bffbf3795c) [The diff shows a change in the import statement from `patchwork.common.utils.types` to `patchwork.common.utils.typing` in the `typed.py` file under `CallLLM` in the `patchwork/steps` directory.](https://github.com/patched-codes/patchwork/pull/340/files#diff-7eee5f695e6a689150f65f01187311311ea8560450c433ec8637b6bffbf3795c)
* File changed: [patchwork/steps/CommitChanges/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-a3309e50ef033035edb67fdc62c1f211add096f9557444b28bcaead7ad48acef) [The import statement in the file has been modified from "from patchwork.common.utils.types" to "from patchwork.common.utils.typing".](https://github.com/patched-codes/patchwork/pull/340/files#diff-a3309e50ef033035edb67fdc62c1f211add096f9557444b28bcaead7ad48acef)
* File changed: [patchwork/steps/CreateIssue/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-420cbe90b0d0a1c1c583967e9f3126742b24adb5c55b183f3b68701266268ce8) [The import statement in the code has been updated from `from patchwork.common.utils.types import IS_CONFIG` to `from patchwork.common.utils.typing import IS_CONFIG` in the `typed.py` file within the `CreateIssue` steps directory.](https://github.com/patched-codes/patchwork/pull/340/files#diff-420cbe90b0d0a1c1c583967e9f3126742b24adb5c55b183f3b68701266268ce8)
* File changed: [patchwork/steps/CreateIssueComment/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-bfa35e5abf689e4b59cf8df582fc552001dfee6b1a3524ccd155b5ebcfde734a) [The diff involves a change in the import statement for a module from `utils.types` to `utils.typing` in the `typed.py` file within the `CreateIssueComment` step of the `patchwork` module.](https://github.com/patched-codes/patchwork/pull/340/files#diff-bfa35e5abf689e4b59cf8df582fc552001dfee6b1a3524ccd155b5ebcfde734a)
* File changed: [patchwork/steps/CreatePR/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-27b139e8d7ae3df11f774d449f6a94be0f14cf4fd728b421bfaebd2ad0a2f8cd) [The import statement for `IS_CONFIG` has been modified from `patchwork.common.utils.types` to `patchwork.common.utils.typing` in the `typed.py` file under the `CreatePR` steps in the `patchwork` module.](https://github.com/patched-codes/patchwork/pull/340/files#diff-27b139e8d7ae3df11f774d449f6a94be0f14cf4fd728b421bfaebd2ad0a2f8cd)
* File changed: [patchwork/steps/CreatePRComment/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-4a0d54503f40d3616fb1f410b35233850e5de1317b6e9491509eda476754c48b) [The import statement in the file has been changed from "types" to "typing" in the path "patchwork/steps/CreatePRComment/typed.py".](https://github.com/patched-codes/patchwork/pull/340/files#diff-4a0d54503f40d3616fb1f410b35233850e5de1317b6e9491509eda476754c48b)
* File changed: [patchwork/steps/ExtractCode/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-5c1e2a2836257b700cb10be3bf510e23fab57827619db331c20131171e236ecf) [The file `typed.py` in the `ExtractCode` module has been updated to import `IS_CONFIG` from a different module `typing` instead of `types`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-5c1e2a2836257b700cb10be3bf510e23fab57827619db331c20131171e236ecf)
* File changed: [patchwork/steps/ExtractCodeContexts/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-d8eecbb3f8fa7ec847484357e85e0804faa3f570bc6c1f336a9735a7e31649ba) [This diff updates the import statement in the file `typed.py` within the `ExtractCodeContexts` module by replacing the import from `IS_CONFIG` to `IS_PATH`. Additionally, the type annotation for the `base_path` attribute is changed from a plain string to an annotated string with the type `IS_PATH`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-d8eecbb3f8fa7ec847484357e85e0804faa3f570bc6c1f336a9735a7e31649ba)
* File changed: [patchwork/steps/ExtractCodeMethodForCommentContexts/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-578219c0a72cc57e3d957bde0d2116b8758726b9874566a3fef6dce00ccb0eae) [The code in `typed.py` now imports `Annotated` from `typing_extensions` and uses it for the `base_path` attribute in the `ExtractCodeMethodForCommentContextsInputs` class, providing additional type information through `IS_PATH` imported from `patchwork.common.utils.typing`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-578219c0a72cc57e3d957bde0d2116b8758726b9874566a3fef6dce00ccb0eae)
* File changed: [patchwork/steps/ExtractDiff/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-5ce2d61d50376ec99b97875207947d0fb5fd6cef8158ee6407a4781eb8e37c08) [The import path for the 'utils' module within the 'common' module in the 'typed.py' file is updated from 'types' to 'typing'.](https://github.com/patched-codes/patchwork/pull/340/files#diff-5ce2d61d50376ec99b97875207947d0fb5fd6cef8158ee6407a4781eb8e37c08)
* File changed: [patchwork/steps/ExtractModelResponse/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-dd60930006e1570f77dfda74df19e1979df7f2516246b52c1040114bdeaf6911) [The diff in the file `typed.py` within the `ExtractModelResponse` module involves changing the import statement from `patchwork.common.utils.types` to `patchwork.common.utils.typing`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-dd60930006e1570f77dfda74df19e1979df7f2516246b52c1040114bdeaf6911)
* File changed: [patchwork/steps/ExtractPackageManagerFile/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-89d8ddc4136c84ccac973b18c0c0108bd4fbbf556228028afcc035aea050c02f) [An import statement was changed in the typed.py file from importing IS_CONFIG from common/utils/types to importing both IS_CONFIG and IS_PATH from common/utils/typing. Additionally, the Annotated type for sbom_vdr_file_path was updated to include IS_PATH in addition to IS_CONFIG.](https://github.com/patched-codes/patchwork/pull/340/files#diff-89d8ddc4136c84ccac973b18c0c0108bd4fbbf556228028afcc035aea050c02f)
* File changed: [patchwork/steps/GenerateCodeRepositoryEmbeddings/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-9892f9a1373719655ec7138b82fdc27beaea41aee11d2d0941cf33acadeccb3b) [This diff involves changing the import statement in the Python file from importing `IS_CONFIG` from `patchwork.common.utils.types` to `IS_CONFIG` from `patchwork.common.utils.typing`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-9892f9a1373719655ec7138b82fdc27beaea41aee11d2d0941cf33acadeccb3b)
* File changed: [patchwork/steps/GenerateEmbeddings/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-1ee879098ead0c92c1757b552fab866b9ac38799a9843a6d52b558048584673d) [The diff involves a renaming of the imported module "types" to "typing" in the typed.py file under the GenerateEmbeddings step in the patchwork application. This change modifies the import statement to reflect the correct module being used.](https://github.com/patched-codes/patchwork/pull/340/files#diff-1ee879098ead0c92c1757b552fab866b9ac38799a9843a6d52b558048584673d)
* File changed: [patchwork/steps/LLM/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-e2b864381f414aeeb9fbd5a90666b56a6715b36c5bef760a0cbbebe94e0487c0) [The import statement in the file typed.py was changed from importing IS_CONFIG from types to importing it from typing in the patchwork project.](https://github.com/patched-codes/patchwork/pull/340/files#diff-e2b864381f414aeeb9fbd5a90666b56a6715b36c5bef760a0cbbebe94e0487c0)
* File changed: [patchwork/steps/ModifyCode/ModifyCode.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-10e9c07de238f7931e667c3d1d277b8b9ba8850bbeced487eb2de77ae6edc278) [The diff removes a function called load_json_file that was used to load a JSON file in ModifyCode.py.](https://github.com/patched-codes/patchwork/pull/340/files#diff-10e9c07de238f7931e667c3d1d277b8b9ba8850bbeced487eb2de77ae6edc278)
* File changed: [patchwork/steps/PR/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-7314b3f35a75a646a72bd4fee80989b2deef7d1729f3ac1f916f1d22818f7448) [The diff shows a change in the import statement within a Python file, where "types" was replaced with "typing," specifically for the module "IS_CONFIG."](https://github.com/patched-codes/patchwork/pull/340/files#diff-7314b3f35a75a646a72bd4fee80989b2deef7d1729f3ac1f916f1d22818f7448)
* File changed: [patchwork/steps/PreparePR/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-0d5994fe0e2db916ef55cbf5769416324ea2414a8b3816f1b1af9638eafb3b00) [The diff in the file `typed.py` in the `PreparePR` module changes an import statement from `utils.types` to `utils.typing` within the `typed.py` file in the `PreparePR` module.](https://github.com/patched-codes/patchwork/pull/340/files#diff-0d5994fe0e2db916ef55cbf5769416324ea2414a8b3816f1b1af9638eafb3b00)
* File changed: [patchwork/steps/PreparePrompt/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-7f16e6f4ea0ee98d9db05990b169e17c3fc7046d7d30c9ed46dce588dccf6fb7) [The import statement for the `IS_CONFIG` constant in the `typed.py` file has been changed from `patchwork.common.utils.types` to `patchwork.common.utils.typing`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-7f16e6f4ea0ee98d9db05990b169e17c3fc7046d7d30c9ed46dce588dccf6fb7)
* File changed: [patchwork/steps/QueryEmbeddings/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-c3e145f6838c6c2978161f27ad80cefeb64c9a35d3e484fc2cb02f8150433e36) [The import statement for `IS_CONFIG` was changed from `patchwork.common.utils.types` to `patchwork.common.utils.typing` in the `typed.py` file under the `QueryEmbeddings` steps.](https://github.com/patched-codes/patchwork/pull/340/files#diff-c3e145f6838c6c2978161f27ad80cefeb64c9a35d3e484fc2cb02f8150433e36)
* File changed: [patchwork/steps/ReadIssues/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-7d1aa186c520609e13cf4d79e08e7d77310535ef745bc416832be91d6d550e4b) [The import statement `from patchwork.common.utils.types` was changed to `from patchwork.common.utils.typing` in the file typed.py under the ReadIssues step of the patchwork project.](https://github.com/patched-codes/patchwork/pull/340/files#diff-7d1aa186c520609e13cf4d79e08e7d77310535ef745bc416832be91d6d550e4b)
* File changed: [patchwork/steps/ReadPRDiffs/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-3620f5358988da86a1fa4499b6cbe59782ed86a5f963e2932ce8e1b11a8e19c0) [The diff in the file typed.py involves changing the import statement to use module typing instead of typing_extensions and modifies the type annotation for the attribute pr_url to just str instead of Annotated[str, IS_CONFIG].](https://github.com/patched-codes/patchwork/pull/340/files#diff-3620f5358988da86a1fa4499b6cbe59782ed86a5f963e2932ce8e1b11a8e19c0)
* File changed: [patchwork/steps/ScanDepscan/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-a2edab78802b1fffb21854873bbf007b13225bacceb2f0e1e033008f68233fe1) [The import statement for `IS_CONFIG` was changed from `patchwork.common.utils.types` to `patchwork.common.utils.typing` in the `typed.py` file under the `ScanDepscan` module.](https://github.com/patched-codes/patchwork/pull/340/files#diff-a2edab78802b1fffb21854873bbf007b13225bacceb2f0e1e033008f68233fe1)
* File changed: [patchwork/steps/ScanSemgrep/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-991501aea1546627b4e9fffef92362d229dda67cd3f061ea8d3ad69717a6f238) [In the file typed.py under ScanSemgrep in the patchwork/steps directory, the import statement for IS_PATH was added from patchwork.common.utils.typing. Additionally, the annotation for sarif_file_path was updated to include both IS_CONFIG and IS_PATH annotations.](https://github.com/patched-codes/patchwork/pull/340/files#diff-991501aea1546627b4e9fffef92362d229dda67cd3f061ea8d3ad69717a6f238)
* File changed: [patchwork/steps/SimplifiedLLM/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-ca05591855b1036af9bdaed433da4d2dace8917d6716106564b70d0679635f7a) [The diff in the file typed.py involves changing the import path from patchwork.common.utils.types to patchwork.common.utils.typing.](https://github.com/patched-codes/patchwork/pull/340/files#diff-ca05591855b1036af9bdaed433da4d2dace8917d6716106564b70d0679635f7a)
* File changed: [patchwork/steps/SlackMessage/typed.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-2279f331d8818bdd107804d08761e4d91122b3fcb3700b3ae90771b7de0a96b8) [The import statement in the file `patchwork/steps/SlackMessage/typed.py` has been changed from `patchwork.common.utils.types` to `patchwork.common.utils.typing`.](https://github.com/patched-codes/patchwork/pull/340/files#diff-2279f331d8818bdd107804d08761e4d91122b3fcb3700b3ae90771b7de0a96b8)
* File changed: [pyproject.toml](https://github.com/patched-codes/patchwork/pull/340/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711) [The version for the "patchwork-cli" project in the pyproject.toml file has been updated from 0.0.26 to 0.0.27.](https://github.com/patched-codes/patchwork/pull/340/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711)
* File changed: [tests/steps/test_ModifyCode.py](https://github.com/patched-codes/patchwork/pull/340/files#diff-9dd43dc015e0f0abe04a2d79a51d1ac6f604c1444d2ee1f220e26ef8cb02f5f6) [Removed the test_load_json_file function from the test_ModifyCode.py file, which included test cases for loading JSON files and checking their contents. It was replaced with a test_save_file_contents function that focuses on saving file contents instead.](https://github.com/patched-codes/patchwork/pull/340/files#diff-9dd43dc015e0f0abe04a2d79a51d1ac6f604c1444d2ee1f220e26ef8cb02f5f6)