__init__.py (removed)¶
Last source¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | """Package defining the ``Namespace`` entity."""
import enum
from typing import Optional
from isshub.domain.utils.entity import (
BaseModelWithId,
optional_field,
required_field,
validated,
)
class NamespaceKind(enum.Enum):
"""All the available kinds of namespace."""
ORGANIZATION = "Organization"
TEAM = "Team"
GROUP = "Group"
@validated() # type: ignore
class _Namespace(BaseModelWithId):
"""A namespace can contain namespace and repositories.
Notes
-----
This is a base class, used by `Namespace` to be able to have a self-reference for the type
of the `namespace` field.
Attributes
----------
id : int
The unique identifier of the namespace
name : str
The name of the namespace. Unique in its parent namespace.
namespace : Optional[Namespace]
Where the namespace can be found.
kind : NamespaceKind
The kind of namespace.
description : Optional[str]
The description of the namespace.
"""
name: str = required_field(str) # type: ignore
namespace = None
kind: NamespaceKind = required_field(NamespaceKind) # type: ignore
description: str = optional_field(str) # type: ignore
@validated() # type: ignore
class Namespace(_Namespace):
"""A namespace can contain namespace and repositories.
Attributes
----------
id : int
The unique identifier of the namespace
name : str
The name of the namespace. Unique in its parent namespace.
namespace : Optional[str]
Where the namespace can be found.
kind : NamespaceKind
The kind of namespace.
description : Optional[str]
The description of the namespace.
"""
namespace: Optional[_Namespace] = optional_field(_Namespace) # type: ignore
|
Changes¶
refactor(core): Rename core domain context to code_repository¶
- Commit
- Hash
- Date
2019-08-15 23:31:33 +0200
- Type
Renamed
- New path
isshub/domain/contexts/code_repository/entities/namespace/__init__.py
- Stats
+0 -0
feat(namespace): Add Namespace entity a description field¶
- Commit
- Hash
- Date
2019-06-07 21:03:51 +0200
- Type
Modified
- Stats
+5 -0
@@ -38,12 +38,15 @@ class _Namespace(BaseModelWithId):
Where the namespace can be found.
kind : NamespaceKind
The kind of namespace.
+ description : Optional[str]
+ The description of the namespace.
"""
name: str = required_field(str) # type: ignore
namespace = None
kind: NamespaceKind = required_field(NamespaceKind) # type: ignore
+ description: str = optional_field(str) # type: ignore
@validated() # type: ignore
@@ -60,6 +63,8 @@ class Namespace(_Namespace):
Where the namespace can be found.
kind : NamespaceKind
The kind of namespace.
+ description : Optional[str]
+ The description of the namespace.
"""
feat(namespace): Add Namespace entity a kind field¶
- Commit
- Hash
- Date
2019-06-07 21:03:51 +0200
- Type
Modified
- Stats
+14 -0
@@ -1,5 +1,6 @@
"""Package defining the ``Namespace`` entity."""
+import enum
from typing import Optional
from isshub.domain.utils.entity import (
@@ -10,6 +11,14 @@ from isshub.domain.utils.entity import (
)
+class NamespaceKind(enum.Enum):
+ """All the available kinds of namespace."""
+
+ ORGANIZATION = "Organization"
+ TEAM = "Team"
+ GROUP = "Group"
+
+
@validated() # type: ignore
class _Namespace(BaseModelWithId):
"""A namespace can contain namespace and repositories.
@@ -27,11 +36,14 @@ class _Namespace(BaseModelWithId):
The name of the namespace. Unique in its parent namespace.
namespace : Optional[Namespace]
Where the namespace can be found.
+ kind : NamespaceKind
+ The kind of namespace.
"""
name: str = required_field(str) # type: ignore
namespace = None
+ kind: NamespaceKind = required_field(NamespaceKind) # type: ignore
@validated() # type: ignore
@@ -46,6 +58,8 @@ class Namespace(_Namespace):
The name of the namespace. Unique in its parent namespace.
namespace : Optional[str]
Where the namespace can be found.
+ kind : NamespaceKind
+ The kind of namespace.
"""
feat(namespace): Add Namespace entity in core domain context¶
- Commit
- Hash
- Date
2019-06-07 21:03:50 +0200
- Type
Added
- Stats
+52 -0
@@ -0,0 +1,52 @@
+"""Package defining the ``Namespace`` entity."""
+
+from typing import Optional
+
+from isshub.domain.utils.entity import (
+ BaseModelWithId,
+ optional_field,
+ required_field,
+ validated,
+)
+
+
+@validated() # type: ignore
+class _Namespace(BaseModelWithId):
+ """A namespace can contain namespace and repositories.
+
+ Notes
+ -----
+ This is a base class, used by `Namespace` to be able to have a self-reference for the type
+ of the `namespace` field.
+
+ Attributes
+ ----------
+ id : int
+ The unique identifier of the namespace
+ name : str
+ The name of the namespace. Unique in its parent namespace.
+ namespace : Optional[Namespace]
+ Where the namespace can be found.
+
+ """
+
+ name: str = required_field(str) # type: ignore
+ namespace = None
+
+
+@validated() # type: ignore
+class Namespace(_Namespace):
+ """A namespace can contain namespace and repositories.
+
+ Attributes
+ ----------
+ id : int
+ The unique identifier of the namespace
+ name : str
+ The name of the namespace. Unique in its parent namespace.
+ namespace : Optional[str]
+ Where the namespace can be found.
+
+ """
+
+ namespace: Optional[_Namespace] = optional_field(_Namespace) # type: ignore