File tree 1 file changed +6
-76
lines changed
1 file changed +6
-76
lines changed Original file line number Diff line number Diff line change 14
14
# limitations under the License.
15
15
#
16
16
17
- import json
17
+ from hopsworks_common .git_commit import (
18
+ GitCommit ,
19
+ )
18
20
19
- import humps
20
- from hopsworks_common import util
21
21
22
-
23
- class GitCommit :
24
- def __init__ (
25
- self ,
26
- name = None ,
27
- email = None ,
28
- message = None ,
29
- commit_hash = None ,
30
- time = None ,
31
- type = None ,
32
- href = None ,
33
- expand = None ,
34
- items = None ,
35
- count = None ,
36
- ** kwargs ,
37
- ):
38
- self ._name = name
39
- self ._email = email
40
- self ._message = message
41
- self ._hash = commit_hash
42
- self ._time = time
43
- self ._type = type
44
- self ._href = href
45
- self ._expand = expand
46
- self ._items = items
47
- self ._count = count
48
-
49
- @classmethod
50
- def from_response_json (cls , json_dict ):
51
- if json_dict :
52
- json_decamelized = humps .decamelize (json_dict )
53
- if "count" in json_decamelized :
54
- if json_decamelized ["count" ] == 0 :
55
- return []
56
- return [cls (** commit ) for commit in json_decamelized ["items" ]]
57
- else :
58
- return cls (** json_decamelized )
59
- else :
60
- return None
61
-
62
- @property
63
- def name (self ):
64
- """Name of the user"""
65
- return self ._name
66
-
67
- @property
68
- def email (self ):
69
- """Email of the user"""
70
- return self ._email
71
-
72
- @property
73
- def message (self ):
74
- """Commit message"""
75
- return self ._message
76
-
77
- @property
78
- def hash (self ):
79
- """Commit hash"""
80
- return self ._hash
81
-
82
- @property
83
- def time (self ):
84
- """Timestamp for the commit"""
85
- return self ._time
86
-
87
- def json (self ):
88
- return json .dumps (self , cls = util .Encoder )
89
-
90
- def __str__ (self ):
91
- return self .json ()
92
-
93
- def __repr__ (self ):
94
- return f"GitCommit({ self ._name !r} , { self ._message !r} , { self ._hash !r} )"
22
+ __all__ = [
23
+ GitCommit ,
24
+ ]
You can’t perform that action at this time.
0 commit comments