Skip to content

Commit

Permalink
Replace path.absolute() with path.resolve() (#4763)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Sep 11, 2021
1 parent cd810c8 commit c47be26
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import torch
import torch.backends.cudnn as cudnn

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path

from models.experimental import attempt_load
Expand Down
2 changes: 1 addition & 1 deletion export.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import torch.nn as nn
from torch.utils.mobile_optimizer import optimize_for_mobile

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path

from models.common import Conv
Expand Down
2 changes: 1 addition & 1 deletion hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
from utils.downloads import attempt_download
from utils.torch_utils import select_device

file = Path(__file__).absolute()
file = Path(__file__).resolve()
check_requirements(requirements=file.parent / 'requirements.txt', exclude=('tensorboard', 'thop', 'opencv-python'))
set_logging(verbose=verbose)

Expand Down
2 changes: 1 addition & 1 deletion models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from copy import deepcopy
from pathlib import Path

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[1].as_posix()) # add yolov5/ to path

from models.common import *
Expand Down
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from torch.optim import Adam, SGD, lr_scheduler
from tqdm import tqdm

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path

import val # for end-of-epoch mAP
Expand Down
2 changes: 1 addition & 1 deletion utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# import torch
# from PIL import ImageFont
#
# FILE = Path(__file__).absolute()
# FILE = Path(__file__).resolve()
# ROOT = FILE.parents[1] # yolov5/ dir
# if str(ROOT) not in sys.path:
# sys.path.append(str(ROOT)) # add ROOT to PATH
Expand Down
2 changes: 1 addition & 1 deletion utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __iter__(self):

class LoadImages: # for inference
def __init__(self, path, img_size=640, stride=32, auto=True):
p = str(Path(path).absolute()) # os-agnostic absolute path
p = str(Path(path).resolve()) # os-agnostic absolute path
if '*' in p:
files = sorted(glob.glob(p, recursive=True)) # glob
elif os.path.isdir(p):
Expand Down
2 changes: 1 addition & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def is_colab():

def is_pip():
# Is file in a pip package?
return 'site-packages' in Path(__file__).absolute().parts
return 'site-packages' in Path(__file__).resolve().parts


def is_ascii(s=''):
Expand Down
2 changes: 1 addition & 1 deletion utils/loggers/wandb/sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import wandb

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[3].as_posix()) # add utils/ to path

from train import train, parse_opt
Expand Down
2 changes: 1 addition & 1 deletion utils/loggers/wandb/wandb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import yaml
from tqdm import tqdm

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[3].as_posix()) # add yolov5/ to path

from utils.datasets import LoadImagesAndLabels
Expand Down
2 changes: 1 addition & 1 deletion val.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import torch
from tqdm import tqdm

FILE = Path(__file__).absolute()
FILE = Path(__file__).resolve()
sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path

from models.experimental import attempt_load
Expand Down

0 comments on commit c47be26

Please sign in to comment.