Updated cpl structure model json handling
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 12s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 19s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 19s
Build on push / database (push) Successful in 16s
Build on push / application (push) Successful in 17s
Build on push / translation (push) Successful in 19s
Build on push / mail (push) Successful in 22s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
Build on push / prepare (push) Successful in 12s
Build on push / query (push) Successful in 19s
Build on push / core (push) Successful in 19s
Build on push / cli (push) Successful in 19s
Build on push / dependency (push) Successful in 19s
Build on push / database (push) Successful in 16s
Build on push / application (push) Successful in 17s
Build on push / translation (push) Successful in 19s
Build on push / mail (push) Successful in 22s
Build on push / auth (push) Successful in 15s
Build on push / api (push) Successful in 15s
This commit is contained in:
@@ -11,9 +11,13 @@ T = TypeVar("T", bound="CPLStructureModel")
|
|||||||
|
|
||||||
|
|
||||||
class CPLStructureModel:
|
class CPLStructureModel:
|
||||||
def __init__(self, path: Optional[str] = None):
|
def __init__(self, path: Optional[str] = None, ignore_fields: Optional[List[str]] = None):
|
||||||
self._path = path
|
self._path = path
|
||||||
|
|
||||||
|
self._ignore = {"_ignore", "_path"}
|
||||||
|
if ignore_fields is not None:
|
||||||
|
self._ignore.update(ignore_fields)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self) -> Optional[str]:
|
def path(self) -> Optional[str]:
|
||||||
return self._path
|
return self._path
|
||||||
@@ -68,7 +72,7 @@ class CPLStructureModel:
|
|||||||
def to_json(self) -> Dict[str, Any]:
|
def to_json(self) -> Dict[str, Any]:
|
||||||
result: Dict[str, Any] = {}
|
result: Dict[str, Any] = {}
|
||||||
for key, value in self.__dict__.items():
|
for key, value in self.__dict__.items():
|
||||||
if not key.startswith("_") or key == "_path":
|
if not key.startswith("_") or key in self._ignore:
|
||||||
continue
|
continue
|
||||||
out_key = _self_or_cls_snake_to_camel(key[1:])
|
out_key = _self_or_cls_snake_to_camel(key[1:])
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Workspace(CPLStructureModel):
|
|||||||
default_project: Optional[str],
|
default_project: Optional[str],
|
||||||
scripts: Dict[str, str],
|
scripts: Dict[str, str],
|
||||||
):
|
):
|
||||||
CPLStructureModel.__init__(self, path)
|
CPLStructureModel.__init__(self, path, ["_actual_projects", "_project_names"])
|
||||||
|
|
||||||
self._name = name
|
self._name = name
|
||||||
self._projects = projects
|
self._projects = projects
|
||||||
|
|||||||
Reference in New Issue
Block a user