FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
feast/sdk/python/feast/project_metadata.py at v0.62.0 · feast-dev/feast · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
feast-dev
/
feast
Public
Notifications
You must be signed in to change notification settings
Fork
1.4k
Star
7.2k
Code
Issues
214
Pull requests
189
Discussions
Actions
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
feast
/
sdk
/
python
/
feast
/
project_metadata.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
109 lines (86 loc) · 3.12 KB
Breadcrumbs
feast
/
sdk
/
python
/
feast
/
project_metadata.py
Copy path
File metadata and controls
109 lines (86 loc) · 3.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Copyright 2019 The Feast Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
uuid
from
typing
import
Optional
from
google
.
protobuf
.
json_format
import
MessageToJson
from
typeguard
import
typechecked
from
feast
.
protos
.
feast
.
core
.
Registry_pb2
import
ProjectMetadata
as
ProjectMetadataProto
@
typechecked
class
ProjectMetadata
:
"""
Tracks project level metadata
Attributes:
project_name: The registry-scoped unique name of the project.
project_uuid: The UUID for this project
"""
project_name
:
str
project_uuid
:
str
def
__init__
(
self
,
*
args
,
project_name
:
Optional
[
str
]
=
None
,
project_uuid
:
Optional
[
str
]
=
None
,
):
"""
Creates an Project metadata object.
Args:
project_name: The registry-scoped unique name of the project.
project_uuid: The UUID for this project
Raises:
ValueError: Parameters are specified incorrectly.
"""
if
not
project_name
:
raise
ValueError
(
"Project name needs to be specified"
)
self
.
project_name
=
project_name
self
.
project_uuid
=
project_uuid
or
f"
{
uuid
.
uuid4
()
}
"
def
__hash__
(
self
)
->
int
:
return
hash
((
self
.
project_name
,
self
.
project_uuid
))
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
ProjectMetadata
):
raise
TypeError
(
"Comparisons should only involve ProjectMetadata class objects."
)
if
(
self
.
project_name
!=
other
.
project_name
or
self
.
project_uuid
!=
other
.
project_uuid
):
return
False
return
True
def
__str__
(
self
):
return
str
(
MessageToJson
(
self
.
to_proto
()))
def
__lt__
(
self
,
other
):
return
self
.
project_name
<
other
.
project_name
@
classmethod
def
from_proto
(
cls
,
project_metadata_proto
:
ProjectMetadataProto
):
"""
Creates project metadata from a protobuf representation.
Args:
project_metadata_proto: A protobuf representation of project metadata.
Returns:
A ProjectMetadata object based on the protobuf.
"""
entity
=
cls
(
project_name
=
project_metadata_proto
.
project
,
project_uuid
=
project_metadata_proto
.
project_uuid
,
)
return
entity
def
to_proto
(
self
)
->
ProjectMetadataProto
:
"""
Converts a project metadata object to its protobuf representation.
Returns:
An ProjectMetadataProto protobuf.
"""
return
ProjectMetadataProto
(
project
=
self
.
project_name
,
project_uuid
=
self
.
project_uuid
)
Back
|
FazBrowse Home
|
New Git URL