Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attribute_definitions.py typos #884

Merged
merged 6 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions client/ayon_core/lib/attribute_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import uuid
import json
import copy
from abc import ABCMeta, abstractmethod, abstractproperty
from abc import ABCMeta, abstractmethod

import clique

Expand All @@ -16,7 +16,7 @@
def register_attr_def_class(cls):
"""Register attribute definition.

Currently are registered definitions used to deserialize data to objects.
Currently registered definitions are used to deserialize data to objects.

Attrs:
cls (AbstractAttrDef): Non-abstract class to be registered with unique
Expand Down Expand Up @@ -60,7 +60,7 @@ def get_default_values(attribute_definitions):
for which default values should be collected.

Returns:
Dict[str, Any]: Default values for passet attribute definitions.
Dict[str, Any]: Default values for passed attribute definitions.
"""

output = {}
Expand All @@ -75,13 +75,13 @@ def get_default_values(attribute_definitions):


class AbstractAttrDefMeta(ABCMeta):
"""Metaclass to validate existence of 'key' attribute.
"""Metaclass to validate the existence of 'key' attribute.

Each object of `AbstractAttrDef` mus have defined 'key' attribute.
Each object of `AbstractAttrDef` must have defined 'key' attribute.
"""

def __call__(self, *args, **kwargs):
obj = super(AbstractAttrDefMeta, self).__call__(*args, **kwargs)
def __call__(cls, *args, **kwargs):
obj = super(AbstractAttrDefMeta, cls).__call__(*args, **kwargs)
init_class = getattr(obj, "__init__class__", None)
if init_class is not AbstractAttrDef:
raise TypeError("{} super was not called in __init__.".format(
Expand Down Expand Up @@ -162,7 +162,8 @@ def __eq__(self, other):
def __ne__(self, other):
return not self.__eq__(other)

@abstractproperty
@property
@abstractmethod
def type(self):
"""Attribute definition type also used as identifier of class.

Expand Down Expand Up @@ -215,7 +216,7 @@ def deserialize(cls, data):


# -----------------------------------------
# UI attribute definitoins won't hold value
# UI attribute definitions won't hold value
# -----------------------------------------

class UIDef(AbstractAttrDef):
Expand Down Expand Up @@ -245,7 +246,7 @@ def __eq__(self, other):


# ---------------------------------------
# Attribute defintioins should hold value
# Attribute definitions should hold value
# ---------------------------------------

class UnknownDef(AbstractAttrDef):
Expand Down Expand Up @@ -311,7 +312,7 @@ def __init__(
):
minimum = 0 if minimum is None else minimum
maximum = 999999 if maximum is None else maximum
# Swap min/max when are passed in opposited order
# Swap min/max when are passed in opposite order
if minimum > maximum:
maximum, minimum = minimum, maximum

Expand Down Expand Up @@ -364,10 +365,10 @@ def convert_value(self, value):
class TextDef(AbstractAttrDef):
"""Text definition.

Text can have multiline option so endline characters are allowed regex
Text can have multiline option so end-line characters are allowed regex
validation can be applied placeholder for UI purposes and default value.

Regex validation is not part of attribute implemntentation.
Regex validation is not part of attribute implementation.

Args:
multiline(bool): Text has single or multiline support.
Expand Down Expand Up @@ -949,7 +950,8 @@ def deserialize_attr_def(attr_def_data):
"""Deserialize attribute definition from data.

Args:
attr_def (Dict[str, Any]): Attribute definition data to deserialize.
attr_def_data (Dict[str, Any]): Attribute definition data to
deserialize.
"""

attr_type = attr_def_data.pop("type")
Expand Down