This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
[QUAD] Bug: Fix attribute_definitions.py typos #6346
Closed
ccaillot
wants to merge
1
commit into
ynput:develop
from
quadproduction:bug/fix_attribute_definitions.py_typos
+16
−14
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
import uuid | ||
import json | ||
import copy | ||
from abc import ABCMeta, abstractmethod, abstractproperty | ||
from abc import ABCMeta, abstractmethod | ||
|
||
import six | ||
import clique | ||
|
@@ -61,7 +61,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 = {} | ||
|
@@ -76,13 +76,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` mus has 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( | ||
|
@@ -164,7 +164,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. | ||
|
||
|
@@ -217,10 +218,11 @@ def deserialize(cls, data): | |
|
||
|
||
# ----------------------------------------- | ||
# UI attribute definitoins won't hold value | ||
# UI attribute definitions won't hold value | ||
# ----------------------------------------- | ||
|
||
class UIDef(AbstractAttrDef): | ||
type = "ui-def" | ||
is_value_def = False | ||
|
||
def __init__(self, key=None, default=None, *args, **kwargs): | ||
|
@@ -247,7 +249,7 @@ def __eq__(self, other): | |
|
||
|
||
# --------------------------------------- | ||
# Attribute defintioins should hold value | ||
# Attribute definitions should hold value | ||
# --------------------------------------- | ||
|
||
class UnknownDef(AbstractAttrDef): | ||
|
@@ -261,7 +263,7 @@ class UnknownDef(AbstractAttrDef): | |
|
||
def __init__(self, key, default=None, **kwargs): | ||
kwargs["default"] = default | ||
super(UnknownDef, self).__init__(key, **kwargs) | ||
super(HiddenDef, self).__init__(key, **kwargs) | ||
|
||
def convert_value(self, value): | ||
return value | ||
|
@@ -313,7 +315,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 | ||
|
||
|
@@ -369,7 +371,7 @@ class TextDef(AbstractAttrDef): | |
Text can have multiline option so endline 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. | ||
|
@@ -760,7 +762,7 @@ def from_dict(cls, data): | |
) | ||
|
||
@classmethod | ||
def from_paths(cls, paths, allow_sequences): | ||
def from_paths(cls, paths, allow_sequences=False): | ||
filenames_by_dir = collections.defaultdict(list) | ||
for path in paths: | ||
normalized = os.path.normpath(path) | ||
|
@@ -951,7 +953,7 @@ 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line too long (81 > 79 characters) |
||
""" | ||
|
||
attr_type = attr_def_data.pop("type") | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this change?