Skip to content

Commit 7e09bf8

Browse files
authored
Add codegen/utils module (#46)
# Motivation <!-- Why is this change necessary? --> # Content <!-- Please include a summary of the change --> # Testing <!-- How was the change tested? --> # Please check the following before marking your PR as ready for review - [x] I have added tests for my changes - [x] I have updated the documentation or added new documentation as needed - [x] I have read and agree to the [Contributor License Agreement](../CLA.md)
1 parent 615572f commit 7e09bf8

File tree

194 files changed

+313
-268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+313
-268
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Graph sitter
1+
# Codegen
22

33
[![Documentation](https://img.shields.io/badge/docs-docs.codegen.com-blue)](https://docs.codegen.com)
44
[![Unit Tests](https://github.com/codegen-sh/codegen-sdk/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/codegen-sh/codegen-sdk/actions/workflows/unit-tests.yml)

hatch.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ macos-max-compat = false
7272
[build]
7373
packages = [
7474
"src/codegen/sdk",
75+
"src/codegen/git",
76+
"src/codegen/utils",
7577
"src/codegen/gscli",
7678
"src/graph_visualization",
7779
]

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ dependencies = [
6262
"toml>=0.10.2",
6363
"PyGithub==2.5.0",
6464
"GitPython==3.1.44",
65+
"psutil>=5.8.0",
6566
]
6667
license = {file = "LICENSE"}
6768
classifiers = [

src/codegen/git/repo_operator/remote_repo_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from codegen.git.utils.clone_url import get_clone_url_for_repo_config, url_to_github
1717
from codegen.git.utils.codeowner_utils import create_codeowners_parser_for_repo
1818
from codegen.git.utils.remote_progress import CustomRemoteProgress
19-
from codegen.git.utils.stopwatch_utils import stopwatch
19+
from codegen.utils.performance.stopwatch_utils import stopwatch
2020

2121
logger = logging.getLogger(__name__)
2222

src/codegen/git/repo_operator/repo_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from codegen.git.configs.constants import CODEGEN_BOT_EMAIL, CODEGEN_BOT_NAME
1818
from codegen.git.schemas.enums import CheckoutResult, FetchResult
1919
from codegen.git.schemas.repo_config import BaseRepoConfig
20-
from codegen.git.utils.stopwatch_utils import stopwatch
21-
from codegen.git.utils.time_utils import humanize_duration
20+
from codegen.utils.performance.stopwatch_utils import stopwatch
21+
from codegen.utils.time_utils import humanize_duration
2222

2323
logger = logging.getLogger(__name__)
2424

src/codegen/git/utils/clone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from codegen.git.schemas.github import GithubType
66
from codegen.git.schemas.repo_config import RepoConfig
77
from codegen.git.utils.clone_url import get_authenticated_clone_url_for_repo_config
8-
from codegen.git.utils.stopwatch_utils import subprocess_with_stopwatch
8+
from codegen.utils.performance.stopwatch_utils import subprocess_with_stopwatch
99

1010
logger = logging.getLogger(__name__)
1111

src/codegen/gscli/generate/runner_imports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""
2020
# TODO: these should also be made public (i.e. included in the docs site)
2121
GS_PRIVATE_IMPORTS = """
22-
from codegen.sdk.codebase.control_flow import StopCodemodException
22+
from codegen.utils.exceptions.control_flow import StopCodemodException
2323
""".strip()
2424

2525
IMPORT_STRING_TEMPLATE = """

src/codegen/sdk/code_generation/current_code_codebase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from codegen.sdk.codebase.config import CodebaseConfig, DefaultConfig, ProjectConfig
1010
from codegen.sdk.core.codebase import Codebase, CodebaseType
1111
from codegen.sdk.enums import ProgrammingLanguage
12-
from codegen.sdk.writer_decorators import DocumentedObject, apidoc_objects, no_apidoc_objects, py_apidoc_objects, ts_apidoc_objects
12+
from codegen.utils.decorators.docs import DocumentedObject, apidoc_objects, no_apidoc_objects, py_apidoc_objects, ts_apidoc_objects
1313

1414
logger = logging.getLogger(__name__)
1515

src/codegen/sdk/codebase/codebase_graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
from rustworkx import PyDiGraph, WeightedEdgeList
1717

1818
from codegen.git.repo_operator.repo_operator import RepoOperator
19-
from codegen.git.utils.stopwatch_utils import stopwatch, stopwatch_with_sentry
2019
from codegen.sdk.codebase.config import CodebaseConfig, DefaultConfig, ProjectConfig, SessionOptions
2120
from codegen.sdk.codebase.config_parser import ConfigParser, get_config_parser_for_language
22-
from codegen.sdk.codebase.control_flow import StopCodemodException
2321
from codegen.sdk.codebase.diff_lite import ChangeType, DiffLite
2422
from codegen.sdk.codebase.flagging.flags import Flags
2523
from codegen.sdk.codebase.transaction_manager import TransactionManager
@@ -35,6 +33,8 @@
3533
from codegen.sdk.extensions.sort import sort_editables
3634
from codegen.sdk.extensions.utils import uncache_all
3735
from codegen.sdk.typescript.external.ts_declassify.ts_declassify import TSDeclassify
36+
from codegen.utils.exceptions.control_flow import StopCodemodException
37+
from codegen.utils.performance.stopwatch_utils import stopwatch, stopwatch_with_sentry
3838

3939
if TYPE_CHECKING:
4040
from codegen.sdk.codebase.node_classes.node_classes import NodeClasses

src/codegen/sdk/codebase/flagging/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from typing_extensions import ReadOnly
55

6-
from codegen.sdk.writer_decorators import apidoc
6+
from codegen.utils.decorators.docs import apidoc
77

88

99
@apidoc

0 commit comments

Comments
 (0)