Scope gitpyhon import in check_git_info() (#10221)

* Scope gitpyhon import in `check_git_info()`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocherandpre-commit-ci[bot] authored and GitHub committed 2022-11-19 14:22:07 +01:00
1 parent 6992dde4bd
commit 40bb8030f8
4 files changed
+17 -15

No files matched your search

+4 -5
View File
@@ -13,7 +13,6 @@ import os
import platform
import random
import re
import shutil
import signal
import sys
import time
@@ -29,7 +28,6 @@ from typing import Optional
from zipfile import ZipFile, is_zipfile
import cv2
import git
import IPython
import numpy as np
import pandas as pd
@@ -346,8 +344,10 @@ def check_git_status(repo='ultralytics/yolov5', branch='master'):
@WorkingDirectory(ROOT)
def check_git(path='.'):
# YOLOv5 git check, return git {remote, branch, commit}
def check_git_info(path='.'):
# YOLOv5 git info check, return {remote, branch, commit}
check_requirements('gitpython')
import git
try:
repo = git.Repo(path)
remote = repo.remotes.origin.url.replace('.git', '') # i.e. 'https://github.com/ultralytics/yolov5'
@@ -1138,4 +1138,3 @@ def imshow(path, im):
cv2.imread, cv2.imwrite, cv2.imshow = imread, imwrite, imshow # redefine
# Variables ------------------------------------------------------------------------------------------------------------
GIT = check_git() # repo, branch, commit