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

Changes from PR #14 #15

Merged
merged 3 commits into from
Sep 8, 2024
Merged

Changes from PR #14 #15

merged 3 commits into from
Sep 8, 2024

Conversation

un-def
Copy link
Owner

@un-def un-def commented Sep 8, 2024

See: #14

tellezhector and others added 3 commits September 8, 2024 07:40
* If the player is disconnected, let the user know (i.e. print a
  message that says `'(no player)'`).
* Propagate KeyInterrupt exceptions properly (important for launcher's
  to properly handle interruptions and redirect interruptions; i.e. if the
  launcher is interrupted, the launcher can in turn interrupt the sub-process).
* `MPRISBlocket._instances` can be a `set` instead of a dictionary.
  Dictionaries where values are always True can always be translated to
  sets (and sets also have O(1) time look-ups).
* `bus_name_has_owner(bus_name=None)` was always equivalent to
  `bus_name_has_owner(bus_name=self._bus_name)`, removed the redudancy
  by removing the default value and always passing an explicit value
* moved null check guard within stop_stdin_read_loop, reducing
  cyclomatic complexity of MPRISBlocket.run
self._instances = set()
# a dict used as an ordered set, keys — well-known names with unique
# instance suffixes, values — True
self._instances = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! sorry about this part of the change, my understanding was that dictonaries had no guaranteed order! but that was an old thing (prev to 3.7).

https://docs.python.org/3.7/library/stdtypes.html#dict

At the moment of writting, at the very bottom of this section there is this note:

Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.

@@ -240,8 +240,6 @@ def run(self, *, loop=None, read_stdin=True, nowait=False):
self.start_stdin_read_loop()
try:
self._loop.run()
except KeyboardInterrupt as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right... (facepalm)

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