From a5382076774fda69c6fb442953eb1c6befe99041 Mon Sep 17 00:00:00 2001 From: Jan Sikorski Date: Tue, 10 Oct 2023 13:16:11 +0200 Subject: [PATCH] Optimized imports --- performance_history_analysis.py | 6 +++--- src/snowcli/cli/nativeapp/init.py | 3 ++- src/snowcli/utils.py | 2 +- tests/test_performance.py | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/performance_history_analysis.py b/performance_history_analysis.py index 2f0db490a5..d22492be6b 100644 --- a/performance_history_analysis.py +++ b/performance_history_analysis.py @@ -3,9 +3,9 @@ from timeit import default_timer as timer from typing import Optional, List, Tuple -import git + import typer -from git import Commit +from git import Commit, Repo from rich import print @@ -64,7 +64,7 @@ def _print_summary_performance_descending( def _analyse_performance_history( rev: str, limit_commits: int, sample_amount: int, print_all_results: bool ): - repo = git.Repo() + repo = Repo() active_branch = repo.active_branch commits_with_results: List[Tuple[Commit, float]] = [] diff --git a/src/snowcli/cli/nativeapp/init.py b/src/snowcli/cli/nativeapp/init.py index a7b095d49f..07c04d416a 100644 --- a/src/snowcli/cli/nativeapp/init.py +++ b/src/snowcli/cli/nativeapp/init.py @@ -7,7 +7,6 @@ from tempfile import TemporaryDirectory from click.exceptions import ClickException from shutil import move, rmtree -from git import Repo from strictyaml import load, as_document @@ -202,6 +201,7 @@ def _init_with_url_and_no_template( Returns: None """ + from git import Repo target_directory: Optional[Path] = None try: @@ -253,6 +253,7 @@ def _init_with_url_and_template( Returns: None """ + from git import Repo path_to_project: Optional[Path] = None try: diff --git a/src/snowcli/utils.py b/src/snowcli/utils.py index 1e506f75ce..96bbce3179 100644 --- a/src/snowcli/utils.py +++ b/src/snowcli/utils.py @@ -14,7 +14,7 @@ import subprocess import sys import warnings -import git + from typing import Dict, List, Literal, Optional, Generic, TypeVar, Callable from pathlib import Path diff --git a/tests/test_performance.py b/tests/test_performance.py index 1573d65579..85a4f0606b 100644 --- a/tests/test_performance.py +++ b/tests/test_performance.py @@ -9,6 +9,7 @@ @pytest.mark.performance def test_snow_help_performance(): + results = [] for _ in range(SAMPLE_AMOUNT): start = timer()