Skip to content

Commit

Permalink
chore(license): add license and format
Browse files Browse the repository at this point in the history
Signed-off-by: weiwee <wbwmat@gmail.com>
  • Loading branch information
sagewe committed Jan 9, 2023
1 parent f1bfdb7 commit c8273d6
Show file tree
Hide file tree
Showing 144 changed files with 1,602 additions and 8,235 deletions.
14 changes: 14 additions & 0 deletions python/fate/arch/abc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from ._address import AddressABC
from ._components import ComponentMeta, Components
from ._computing import CSessionABC, CTableABC
Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/abc/_address.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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 abc


Expand Down
3 changes: 0 additions & 3 deletions python/fate/arch/abc/_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
# You may obtain a copy of the License at
#
# http://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 typing
from abc import ABCMeta

Expand Down
18 changes: 15 additions & 3 deletions python/fate/arch/abc/_federation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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 abc
import typing
from abc import ABCMeta
Expand All @@ -19,9 +33,7 @@ def session_id(self) -> str:
...

@abc.abstractmethod
def get(
self, name: str, tag: str, parties: typing.List[Party], gc: GarbageCollectionABC
) -> typing.List:
def get(self, name: str, tag: str, parties: typing.List[Party], gc: GarbageCollectionABC) -> typing.List:
"""
get objects/tables from ``parties``
Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/abc/_gc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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 abc


Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/abc/_path.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from abc import ABCMeta


Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/common/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from ._types import (
BaseType,
CoordinationCommunicationProtocol,
Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/common/_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
class EngineType(object):
COMPUTING = "computing"
STORAGE = "storage"
Expand Down
18 changes: 15 additions & 3 deletions python/fate/arch/common/address.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from ..abc import AddressABC
from ..metastore.db_utils import StorageConnector

Expand Down Expand Up @@ -107,9 +121,7 @@ def __repr__(self):


class ApiAddress(AddressBase):
def __init__(
self, method="POST", url=None, header=None, body=None, connector_name=None
):
def __init__(self, method="POST", url=None, header=None, body=None, connector_name=None):
self.method = method
self.url = url
self.header = header if header else {}
Expand Down
34 changes: 19 additions & 15 deletions python/fate/arch/common/data_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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 os
import uuid

Expand All @@ -9,32 +23,22 @@ def default_output_info(task_id, task_version, output_type):
return f"output_{output_type}_{task_id}_{task_version}", uuid.uuid1().hex


def default_input_fs_path(
name, namespace, prefix=None, storage_engine=StorageEngine.HDFS
):
def default_input_fs_path(name, namespace, prefix=None, storage_engine=StorageEngine.HDFS):
if storage_engine == StorageEngine.HDFS:
return default_hdfs_path(
data_type="input", name=name, namespace=namespace, prefix=prefix
)
return default_hdfs_path(data_type="input", name=name, namespace=namespace, prefix=prefix)
elif storage_engine == StorageEngine.LOCALFS:
return default_localfs_path(data_type="input", name=name, namespace=namespace)


def default_output_fs_path(
name, namespace, prefix=None, storage_engine=StorageEngine.HDFS
):
def default_output_fs_path(name, namespace, prefix=None, storage_engine=StorageEngine.HDFS):
if storage_engine == StorageEngine.HDFS:
return default_hdfs_path(
data_type="output", name=name, namespace=namespace, prefix=prefix
)
return default_hdfs_path(data_type="output", name=name, namespace=namespace, prefix=prefix)
elif storage_engine == StorageEngine.LOCALFS:
return default_localfs_path(data_type="output", name=name, namespace=namespace)


def default_localfs_path(name, namespace, data_type):
return os.path.join(
get_project_base_directory(), "localfs", data_type, namespace, name
)
return os.path.join(get_project_base_directory(), "localfs", data_type, namespace, name)


def default_hdfs_path(data_type, name, namespace, prefix=None):
Expand Down
4 changes: 1 addition & 3 deletions python/fate/arch/computing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019 The Eggroll Authors. All Rights Reserved.
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,8 +12,6 @@
# 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.
#


from ._type import ComputingEngine
from ._util import is_table
Expand Down
3 changes: 1 addition & 2 deletions python/fate/arch/computing/_type.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019 The Eggroll Authors. All Rights Reserved.
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,6 @@
# 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.
#


class ComputingEngine(object):
Expand Down
3 changes: 1 addition & 2 deletions python/fate/arch/computing/_util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019 The Eggroll Authors. All Rights Reserved.
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,6 @@
# 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.
#


from ..abc import CTableABC
Expand Down
3 changes: 1 addition & 2 deletions python/fate/arch/computing/standalone/_csession.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019 The Eggroll Authors. All Rights Reserved.
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,6 @@
# 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 logging
from collections.abc import Iterable
Expand Down
3 changes: 1 addition & 2 deletions python/fate/arch/computing/standalone/_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2019 The Eggroll Authors. All Rights Reserved.
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,7 +12,6 @@
# 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 itertools
import logging
Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/context/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from ._context import Context, Namespace

__all__ = ["Context", "Namespace"]
14 changes: 14 additions & 0 deletions python/fate/arch/context/_cipher.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from fate.interface import CipherKit as CipherKitInterface

from ..tensor._phe import PHECipher
Expand Down
14 changes: 14 additions & 0 deletions python/fate/arch/context/_context.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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
#
# http://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.
from contextlib import contextmanager
from copy import copy
from typing import Iterator, List, Optional
Expand Down
Loading

0 comments on commit c8273d6

Please sign in to comment.