mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-08-17 10:57:03 +00:00
#743 - Trying to fix this.
This commit is contained in:
@@ -8,32 +8,52 @@ import attr
|
||||
class RepositoryData:
|
||||
"""RepositoryData class."""
|
||||
|
||||
id: int = 0
|
||||
full_name: str = ""
|
||||
pushed_at: str = ""
|
||||
category: str = ""
|
||||
archived: bool = False
|
||||
description: str = ""
|
||||
manifest_name: str = None
|
||||
topics: List[str] = []
|
||||
fork: bool = False
|
||||
domain: str = ""
|
||||
default_branch: str = None
|
||||
stargazers_count: int = 0
|
||||
last_commit: str = ""
|
||||
file_name: str = ""
|
||||
content_in_root: bool = False
|
||||
zip_release: bool = False
|
||||
filename: str = ""
|
||||
render_readme: bool = False
|
||||
hide_default_branch: bool = False
|
||||
domains: List[str] = []
|
||||
country: List[str] = []
|
||||
authors: List[str] = []
|
||||
homeassistant: str = None # Minimum Home Assistant version
|
||||
category: str = ""
|
||||
content_in_root: bool = False
|
||||
country: List[str] = []
|
||||
config_flow: bool = False
|
||||
default_branch: str = None
|
||||
description: str = ""
|
||||
domain: str = ""
|
||||
domains: List[str] = []
|
||||
downloads: int = 0
|
||||
file_name: str = ""
|
||||
filename: str = ""
|
||||
first_install: bool = False
|
||||
fork: bool = False
|
||||
full_name: str = ""
|
||||
hacs: str = None # Minimum HACS version
|
||||
persistent_directory: str = None
|
||||
hide: bool = False
|
||||
hide_default_branch: bool = False
|
||||
homeassistant: str = None # Minimum Home Assistant version
|
||||
id: int = 0
|
||||
iot_class: str = None
|
||||
installed: bool = False
|
||||
installed_commit: str = None
|
||||
installed_version: str = None
|
||||
open_issues: int = 0
|
||||
last_commit: str = None
|
||||
last_version: str = None
|
||||
last_updated: str = 0
|
||||
manifest_name: str = None
|
||||
new: bool = True
|
||||
persistent_directory: str = None
|
||||
pushed_at: str = ""
|
||||
releases: bool = False
|
||||
render_readme: bool = False
|
||||
published_tags: List[str] = []
|
||||
selected_tag: str = None
|
||||
show_beta: bool = False
|
||||
stargazers_count: int = 0
|
||||
topics: List[str] = []
|
||||
zip_release: bool = False
|
||||
|
||||
@property
|
||||
def stars(self):
|
||||
"""Return the stargazers count."""
|
||||
return self.stargazers_count or 0
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -53,9 +73,20 @@ class RepositoryData:
|
||||
for key in source:
|
||||
if key in data.__dict__:
|
||||
if key == "pushed_at":
|
||||
setattr(
|
||||
data, key, datetime.strptime(source[key], "%Y-%m-%dT%H:%M:%SZ")
|
||||
)
|
||||
if "Z" in source[key]:
|
||||
setattr(
|
||||
data,
|
||||
key,
|
||||
datetime.strptime(source[key], "%Y-%m-%dT%H:%M:%SZ"),
|
||||
)
|
||||
else:
|
||||
setattr(
|
||||
data,
|
||||
key,
|
||||
datetime.strptime(source[key], "%Y-%m-%dT%H:%M:%S"),
|
||||
)
|
||||
elif key == "id":
|
||||
setattr(data, key, str(source[key]))
|
||||
elif key == "county":
|
||||
if isinstance(source[key], str):
|
||||
setattr(data, key, [source[key]])
|
||||
@@ -70,9 +101,18 @@ class RepositoryData:
|
||||
for key in data:
|
||||
if key in self.__dict__:
|
||||
if key == "pushed_at":
|
||||
setattr(
|
||||
self, key, datetime.strptime(data[key], "%Y-%m-%dT%H:%M:%SZ")
|
||||
)
|
||||
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 == "county":
|
||||
if isinstance(data[key], str):
|
||||
setattr(self, key, [data[key]])
|
||||
|
Reference in New Issue
Block a user