Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused pushed_at attribute #2993

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class RepositoryData:
new: bool = True
open_issues: int = 0
published_tags: list[str] = []
pushed_at: str = ""
releases: bool = False
selected_tag: str = None
show_beta: bool = False
Expand Down Expand Up @@ -150,17 +149,6 @@ def update_data(self, data: dict, action: bool = False) -> None:
for key in data:
if key not in self.__dict__:
continue
if key == "pushed_at":
if data[key] == "":
continue
if "Z" in data[key]:
setattr(
self,
key,
datetime.strptime(data[key], "%Y-%m-%dT%H:%M:%SZ"),
)
else:
setattr(self, key, datetime.strptime(data[key], "%Y-%m-%dT%H:%M:%S"))
elif key == "id":
setattr(self, key, str(data[key]))
elif key == "country":
Expand Down Expand Up @@ -449,6 +437,9 @@ async def common_registration(self) -> None:
self.logger.debug("%s Did not update, content was not modified", self.string)
return

if self.repository_object:
self.data.last_updated = self.repository_object.attributes.get("pushed_at", 0)

# Set topics
self.data.topics = self.data.topics

Expand Down
1 change: 0 additions & 1 deletion custom_components/hacs/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
("manifest_name", None),
("open_issues", 0),
("published_tags", []),
("pushed_at", ""),
("releases", False),
("selected_tag", None),
("show_beta", False),
Expand Down
1 change: 0 additions & 1 deletion scripts/data/generate_category_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
("last_version", None),
("manifest_name", None),
("open_issues", 0),
("pushed_at", ""),
("stargazers_count", 0),
("topics", []),
)
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/repository_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"full_name": "test/test",
"fork": false,
"description": "Sample description for repository.",
"pushed_at": "1970-01-01T00:00:00Z",
"stargazers_count": 999,
"archived": false,
"topics": [
Expand Down
2 changes: 0 additions & 2 deletions tests/repositories/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@


def test_data_structure():
RepositoryData.create_from_dict({"pushed_at": ""})
RepositoryData.create_from_dict({"country": ""})
RepositoryData.create_from_dict({"country": [""]})
RepositoryData.create_from_dict({"pushed_at": "1970-01-01T00:00:00"})
data = RepositoryData.create_from_dict(repository_data)
assert data.stargazers_count == 999
assert isinstance(data.to_json(), dict)
1 change: 0 additions & 1 deletion tests/sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"full_name": "test/test",
"fork": False,
"description": "Sample description for repository.",
"pushed_at": "1970-01-01T00:00:00Z",
"stargazers_count": 999,
"archived": False,
"topics": ["topic1", "topic2"],
Expand Down