blob: 58b96a1b93a0ed6ea9688b5faea4d74bfdcb161d (
plain)
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
|
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from typing import Any, Optional
from azure.ai.ml._restclient.v2023_04_01_preview.models import IntellectualProperty as RestIntellectualProperty
from azure.ai.ml._utils._experimental import experimental
from azure.ai.ml.constants._assets import IPProtectionLevel
from azure.ai.ml.entities._mixins import RestTranslatableMixin
@experimental
class IntellectualProperty(RestTranslatableMixin):
"""Intellectual property settings definition.
:keyword publisher: The publisher's name.
:paramtype publisher: Optional[str]
:keyword protection_level: Asset Protection Level. Accepted values are IPProtectionLevel.ALL ("all") and
IPProtectionLevel.NONE ("none"). Defaults to IPProtectionLevel.ALL ("all").
:paramtype protection_level: Optional[Union[str, ~azure.ai.ml.constants.IPProtectionLevel]]
.. admonition:: Example:
.. literalinclude:: ../samples/ml_samples_misc.py
:start-after: [START intellectual_property_configuration]
:end-before: [END intellectual_property_configuration]
:language: python
:dedent: 8
:caption: Configuring intellectual property settings on a CommandComponent.
"""
def __init__(
self, *, publisher: Optional[str] = None, protection_level: IPProtectionLevel = IPProtectionLevel.ALL
) -> None:
self.publisher = publisher
self.protection_level = protection_level
def _to_rest_object(self) -> RestIntellectualProperty:
return RestIntellectualProperty(publisher=self.publisher, protection_level=self.protection_level)
@classmethod
def _from_rest_object(cls, obj: RestIntellectualProperty) -> "IntellectualProperty":
return cls(publisher=obj.publisher, protection_level=obj.protection_level)
def __eq__(self, other: Any) -> bool:
if not isinstance(other, IntellectualProperty):
return NotImplemented
return self.publisher == other.publisher and self.protection_level == other.protection_level
|