Skip to content

Commit d367b79

Browse files
committed
Adapt git* files
1 parent f5bd9b0 commit d367b79

20 files changed

+332
-22
lines changed

Diff for: python/hopsworks/core/git_api.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.core.git_api import (
18+
GitApi,
19+
)
20+
21+
22+
__all__ = [
23+
GitApi,
24+
]

Diff for: python/hopsworks/core/git_op_execution_api.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.core.git_op_execution_api import (
18+
GitOpExecutionApi,
19+
)
20+
21+
22+
__all__ = [
23+
GitOpExecutionApi,
24+
]

Diff for: python/hopsworks/core/git_provider_api.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.core.git_provider_api import (
18+
GitProviderApi,
19+
)
20+
21+
22+
__all__ = [
23+
GitProviderApi,
24+
]

Diff for: python/hopsworks/core/git_remote_api.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.core.git_remote_api import (
18+
GitRemoteApi,
19+
)
20+
21+
22+
__all__ = [
23+
GitRemoteApi,
24+
]

Diff for: python/hopsworks/engine/git_engine.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.engine.git_engine import (
18+
GitEngine,
19+
)
20+
21+
22+
__all__ = [
23+
GitEngine,
24+
]

Diff for: python/hopsworks/git_commit.py

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
import json
18+
19+
import humps
20+
from hopsworks_common import util
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})"

Diff for: python/hopsworks/git_op_execution.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.git_op_execution import (
18+
GitOpExecution,
19+
)
20+
21+
22+
__all__ = [
23+
GitOpExecution,
24+
]

Diff for: python/hopsworks/git_provider.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.git_provider import (
18+
GitProvider,
19+
)
20+
21+
22+
__all__ = [
23+
GitProvider,
24+
]

Diff for: python/hopsworks/git_remote.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.git_remote import (
18+
GitRemote,
19+
)
20+
21+
22+
__all__ = [
23+
GitRemote,
24+
]

Diff for: python/hopsworks/git_repo.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright 2024 Hopsworks AB
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
from hopsworks_common.git_repo import (
18+
GitRepo,
19+
)
20+
21+
22+
__all__ = [
23+
GitRepo,
24+
]

Diff for: python/hopsworks_common/core/git_api.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
import logging
1919
from typing import List, Union
2020

21-
from hopsworks import (
21+
from hopsworks_common import (
2222
client,
2323
git_commit,
2424
git_file_status,
2525
git_op_execution,
2626
git_repo,
2727
util,
2828
)
29-
from hopsworks.client.exceptions import GitException
30-
from hopsworks.core import git_provider_api
31-
from hopsworks.engine import git_engine
32-
from hopsworks.git_file_status import GitFileStatus
29+
from hopsworks_common.client.exceptions import GitException
30+
from hopsworks_common.core import git_provider_api
31+
from hopsworks_common.engine import git_engine
32+
from hopsworks_common.git_file_status import GitFileStatus
3333

3434

3535
class GitApi:

Diff for: python/hopsworks_common/core/git_op_execution_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
from hopsworks import client, git_op_execution
17+
from hopsworks_common import client, git_op_execution
1818

1919

2020
class GitOpExecutionApi:

Diff for: python/hopsworks_common/core/git_provider_api.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import json
1818

19-
from hopsworks import client, git_provider
20-
from hopsworks.client.exceptions import GitException
21-
from hopsworks.engine import git_engine
19+
from hopsworks_common import client, git_provider
20+
from hopsworks_common.client.exceptions import GitException
21+
from hopsworks_common.engine import git_engine
2222

2323

2424
class GitProviderApi:

Diff for: python/hopsworks_common/core/git_remote_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# limitations under the License.
1515
#
1616

17-
from hopsworks import client, git_op_execution, git_remote
18-
from hopsworks.engine import git_engine
17+
from hopsworks_common import client, git_op_execution, git_remote
18+
from hopsworks_common.engine import git_engine
1919

2020

2121
class GitRemoteApi:

Diff for: python/hopsworks_common/engine/git_engine.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import logging
1818
import time
1919

20-
from hopsworks.client.exceptions import GitException
21-
from hopsworks.core import git_op_execution_api
20+
from hopsworks_common.client.exceptions import GitException
21+
from hopsworks_common.core import git_op_execution_api
2222

2323

2424
class GitEngine:

Diff for: python/hopsworks_common/git_commit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import json
1818

1919
import humps
20-
from hopsworks import util
20+
from hopsworks_common import util
2121

2222

2323
class GitCommit:

0 commit comments

Comments
 (0)