Skip to content

Commit d5338aa

Browse files
authored
Merge pull request #551 from Lingikaushikreddy/fix/ruff-0.17-datetime-import-convention
fix: satisfy ruff 0.17 ICN001 for datetime imports
2 parents b9ec136 + bf6a53d commit d5338aa

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎roboflow/cli/handlers/project.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ def _get_project(args): # noqa: ANN001
201201
if key in project:
202202
val = project[key]
203203
if key in epoch_keys and isinstance(val, (int, float)):
204-
import datetime
204+
from datetime import datetime
205205

206-
val = datetime.datetime.fromtimestamp(val).strftime("%Y-%m-%d %H:%M:%S")
206+
val = datetime.fromtimestamp(val).strftime("%Y-%m-%d %H:%M:%S")
207207
elif isinstance(val, dict):
208208
val = ", ".join(f"{k}: {v}" for k, v in val.items())
209209
lines.append(f" {label:12s} {val}")

‎roboflow/core/project.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import datetime
21
import json
32
import mimetypes
43
import os
54
import sys
65
import time
76
import warnings
7+
from datetime import datetime
88
from typing import Dict, List, Optional, Union
99

1010
import filetype
@@ -68,7 +68,7 @@ def __init__(self, api_key: str, a_project: dict, model_format: Optional[str] =
6868
self.annotation = a_project["annotation"]
6969
self.classes = a_project["classes"]
7070
self.colors = a_project["colors"]
71-
self.created = datetime.datetime.fromtimestamp(a_project["created"])
71+
self.created = datetime.fromtimestamp(a_project["created"])
7272
self.id = a_project["id"]
7373
self.images = a_project["images"]
7474
self.name = a_project["name"]
@@ -77,7 +77,7 @@ def __init__(self, api_key: str, a_project: dict, model_format: Optional[str] =
7777
self.type = a_project["type"]
7878
self.multilabel = a_project.get("multilabel", False)
7979
self.unannotated = a_project["unannotated"]
80-
self.updated = datetime.datetime.fromtimestamp(a_project["updated"])
80+
self.updated = datetime.fromtimestamp(a_project["updated"])
8181
self.model_format = model_format
8282

8383
temp = self.id.rsplit("/")

0 commit comments

Comments
 (0)