Skip to content

Define __dir__ to contain COMMANDS and SENSORS#76

Merged
jcarbaugh merged 3 commits into
jcarbaugh:mainfrom
ronnie-llamado:feature/update-roku-dir
Apr 21, 2023
Merged

Define __dir__ to contain COMMANDS and SENSORS#76
jcarbaugh merged 3 commits into
jcarbaugh:mainfrom
ronnie-llamado:feature/update-roku-dir

Conversation

@ronnie-llamado

@ronnie-llamado ronnie-llamado commented Nov 30, 2021

Copy link
Copy Markdown
Contributor

Update Roku.__dir__ to contain COMMANDS and SENSORS. This is helpful when running python interactively, enabling the user to call dir() on a Roku instance and see the commands and sensors as well as the defined methods.

Previously:

>>> r = roku.Roku.discover()[0]
>>> dir(r)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', 
'__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', 
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
'_app_for_id', '_app_for_name', '_call', '_conn', '_connect', '_get', '_post', 'active_app', 'apps', 'commands', 'current_app', 
'device_info', 'discover', 'host', 'icon', 'input', 'launch', 'port', 'power_state', 'store', 'timeout', 'touch', 'tv_channels']

With PR:

>>> r = roku.Roku.discover()[0]
>>> dir(r)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', 
'__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', 
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
'_app_for_id', '_app_for_name', '_call', '_conn', '_connect', '_get', '_post', 'acceleration', 'active_app', 'apps', 'back', 'backspace', 
'channel_down', 'channel_up', 'commands', 'current_app', 'device_info', 'discover', 'down', 'enter', 'find_remote', 'forward', 'home', 
'host', 'icon', 'info', 'input', 'input_av1', 'input_hdmi1', 'input_hdmi2', 'input_hdmi3', 'input_hdmi4', 'input_tuner', 'launch', 'left', 
'literal', 'magnetic', 'orientation', 'play', 'port', 'power', 'power_state', 'poweroff', 'poweron', 'replay', 'reverse', 'right', 'rotation', 
'search', 'select', 'store', 'timeout', 'touch', 'tv_channels', 'up', 'volume_down', 'volume_mute', 'volume_up']

@ronnie-llamado ronnie-llamado changed the title Update __dir__ to contain Roku.commands Update __dir__ to contain COMMANDS and SENSORS Nov 30, 2021
@ronnie-llamado ronnie-llamado changed the title Update __dir__ to contain COMMANDS and SENSORS Define __dir__ to contain COMMANDS and SENSORS Nov 30, 2021
@jcarbaugh

Copy link
Copy Markdown
Owner

Very smart, thank you!

@jcarbaugh jcarbaugh merged commit 1edddae into jcarbaugh:main Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants