kopia lustrzana https://github.com/Langenfeld/py-gitea
Add 'actions' unit to RepoUnits and update related parsers
rodzic
ad08216ace
commit
97ff070d10
|
@ -15,6 +15,7 @@ class RepoUnits:
|
||||||
pulls: str = "none"
|
pulls: str = "none"
|
||||||
releases: str = "none"
|
releases: str = "none"
|
||||||
ext_wiki: str = "none"
|
ext_wiki: str = "none"
|
||||||
|
actions: str = "none"
|
||||||
|
|
||||||
def to_dict(self) -> dict[str, str]:
|
def to_dict(self) -> dict[str, str]:
|
||||||
"""Return the correctly prefixed (added "repo.") representation for gitea Repository runit Rights"""
|
"""Return the correctly prefixed (added "repo.") representation for gitea Repository runit Rights"""
|
||||||
|
@ -26,7 +27,7 @@ class RepoUnits:
|
||||||
def from_dict(cls, unit_dict: dict[str, str]) -> "RepoUnits":
|
def from_dict(cls, unit_dict: dict[str, str]) -> "RepoUnits":
|
||||||
"""Parse all known repo units from the dictionary returned by the api"""
|
"""Parse all known repo units from the dictionary returned by the api"""
|
||||||
return RepoUnits(
|
return RepoUnits(
|
||||||
**{k[5:]: v for k, v in unit_dict.items() if k[5:] in fields(cls)}
|
**{k[5:]: v for k, v in unit_dict.items() if k[5:] in {field.name for field in fields(cls)}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -415,6 +416,7 @@ class Repository(ApiObject):
|
||||||
"enable_prune",
|
"enable_prune",
|
||||||
"external_tracker",
|
"external_tracker",
|
||||||
"external_wiki",
|
"external_wiki",
|
||||||
|
"has_actions",
|
||||||
"has_issues",
|
"has_issues",
|
||||||
"has_projects",
|
"has_projects",
|
||||||
"has_pull_requests",
|
"has_pull_requests",
|
||||||
|
@ -946,6 +948,10 @@ class Team(ApiObject):
|
||||||
"units_map": lambda gitea, o: RepoUnits.from_dict(o),
|
"units_map": lambda gitea, o: RepoUnits.from_dict(o),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_parsers_to_fields = {
|
||||||
|
"units_map": lambda m: RepoUnits.to_dict(m),
|
||||||
|
}
|
||||||
|
|
||||||
_patchable_fields = {
|
_patchable_fields = {
|
||||||
"can_create_org_repo",
|
"can_create_org_repo",
|
||||||
"description",
|
"description",
|
||||||
|
|
Ładowanie…
Reference in New Issue