Skip to content

Commit

Permalink
Removes all occurences of "dummy"
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 581895387
Change-Id: If075135adff783653ff78d7bb7a35bff47baae42
  • Loading branch information
marksandler2 authored and ML Collections Authors committed Nov 13, 2023
1 parent 091aa2b commit b247789
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
6 changes: 3 additions & 3 deletions ml_collections/config_dict/config_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ def _apply_cast_op(self, field_type):
applied whereas `_apply_cast_op` generates a FieldReference with casted
field_type.
Since `fn(value, *args)` we need to ignore `value` which now contains a
dummy default value of field_type.
Since the signature is `fn(value, *args)` we need to ignore `value`
which now contains a unused default value of field_type.
Args:
field_type: data type to cast to.
Expand All @@ -399,7 +399,7 @@ def _apply_cast_op(self, field_type):
A new FieldReference with of `field_type`.
"""
return FieldReference(
field_type(), # Creates dummy default value matching `field_type`.
field_type(), # Creates unused default value matching `field_type`.
field_type=field_type,
op=_Op(lambda _, val: field_type(val), # `fn` ignores `field_type()`.
[self]),
Expand Down
4 changes: 2 additions & 2 deletions ml_collections/config_dict/examples/config_dict_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
default='ml_collections/config_dict/examples/config.py')


def dummy_function(string, **unused_kwargs):
def hello_function(string, **unused_kwargs):
return 'Hello {}'.format(string)


Expand Down Expand Up @@ -110,7 +110,7 @@ def main(_):

# Using ** unrolling to pass the config to a function as named arguments.
print_section('Unpacking with **')
print(dummy_function(**config))
print(hello_function(**config))

# You can even load a dictionary (notice it is not ConfigDict anymore) from
# a yaml string representation of ConfigDict.
Expand Down
2 changes: 1 addition & 1 deletion ml_collections/config_flags/config_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def _LoadConfigModule(name: str, path: str):


class _ErrorConfig:
"""Dummy ConfigDict that raises an error on any attribute access."""
"""ConfigDict object that raises an error on any attribute access."""

def __init__(self, error):
super(_ErrorConfig, self).__init__()
Expand Down
6 changes: 3 additions & 3 deletions ml_collections/config_flags/tests/config_overriding_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def testOverridingConfigDict(self):
'list[0]': 5,
'nested_list[0][0]': 5,
'nested_configdict.integer': 5,
'unusable_config.dummy_attribute': 5
'unusable_config.valid_attribute': 5
}
override_flags = _get_override_flags(overrides, '--test_config.{}={}')
values = _parse_flags('./program {} {}'.format(config_flag, override_flags))
Expand All @@ -543,8 +543,8 @@ def testOverridingConfigDict(self):
overrides['nested_list[0][0]'])
self.assertEqual(values.test_config.nested_configdict.integer,
overrides['nested_configdict.integer'])
self.assertEqual(values.test_config.unusable_config.dummy_attribute,
overrides['unusable_config.dummy_attribute'])
self.assertEqual(values.test_config.unusable_config.valid_attribute,
overrides['unusable_config.valid_attribute'])
# Attribute error.
overrides = {'nonexistent': 'value'}
with self.assertRaises(AttributeError):
Expand Down
15 changes: 7 additions & 8 deletions ml_collections/config_flags/tests/configdict_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class UnusableConfig(object):
This class only has unusable attributes. There are two
exceptions for which this class behaves normally:
* Python's special functions which start and end with a double underscore.
* `dummy_attribute`, an attribute used to test the class.
* `valid_attribute`, an attribute used to test the class.
For other attributes, both `hasttr(obj, attr)` and `callable(obj, attr)` will
return True. Calling `obj.attr` will return a function which takes no
Expand All @@ -51,7 +51,7 @@ class UnusableConfig(object):
"""

def __init__(self):
self._dummy_attribute = 1
self._valid_attribute = 1

def __getattr__(self, attribute):
"""Get an arbitrary attribute.
Expand Down Expand Up @@ -80,13 +80,12 @@ def raise_attribute_error_fun():
return raise_attribute_error_fun

@property
def dummy_attribute(self):
return self._dummy_attribute

@dummy_attribute.setter
def dummy_attribute(self, value):
self._dummy_attribute = value
def valid_attribute(self):
return self._valid_attribute

@valid_attribute.setter
def valid_attribute(self, value):
self._valid_attribute = value

def get_config():
"""Returns a ConfigDict. Used for tests."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


#####
# Simple dummy configuration classes.
# Simple configuration class for testing.
@dataclasses.dataclass
class MyModelConfig:
foo: int
Expand Down
4 changes: 2 additions & 2 deletions ml_collections/config_flags/tests/mini_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Dummy Config file."""
"""Placeholder Config file."""


class MiniConfig(object):
"""Just a dummy config."""
"""Just a placeholder config."""

def __init__(self):
self.dict = {}
Expand Down
4 changes: 2 additions & 2 deletions ml_collections/config_flags/tests/mock_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Dummy Config file."""
"""Placeholder Config file."""

import copy

from ml_collections.config_flags.tests import spork


class TestConfig(object):
"""Just a dummy config."""
"""Default Test config value."""

def __init__(self):
self.integer = 23
Expand Down

0 comments on commit b247789

Please sign in to comment.