Skip to content

Commit

Permalink
prevent merging duplicate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
spyoungtech committed Aug 23, 2023
1 parent 06a38f8 commit 47c3b64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 6 additions & 2 deletions ahk/_async/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ def __init__(
is_async = False
is_async = True # unasync: remove
if is_async:
extensions = [entry.extension for name, entry in _extension_method_registry.async_methods.items()]
extensions = list(
set(entry.extension for name, entry in _extension_method_registry.async_methods.items())
)
else:
extensions = [entry.extension for name, entry in _extension_method_registry.sync_methods.items()]
extensions = list(
set(entry.extension for name, entry in _extension_method_registry.sync_methods.items())
)
self._extension_registry = _extension_method_registry
self._extensions = extensions
else:
Expand Down
7 changes: 3 additions & 4 deletions ahk/_sync/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ def __init__(
TransportClass: Optional[Type[Transport]] = None,
directives: Optional[list[Directive | Type[Directive]]] = None,
executable_path: str = '',
extensions: list[Extension] | None | Literal['auto'] = None
extensions: list[Extension] | None | Literal['auto'] = None,
):
self._extension_registry: _ExtensionMethodRegistry
self._extensions: list[Extension]
if extensions == 'auto':
is_async = False
if is_async:
extensions = [entry.extension for name, entry in _extension_method_registry.async_methods.items()]
extensions = list(set(entry.extension for name, entry in _extension_method_registry.async_methods.items()))
else:
extensions = [entry.extension for name, entry in _extension_method_registry.sync_methods.items()]
extensions = list(set(entry.extension for name, entry in _extension_method_registry.sync_methods.items()))
self._extension_registry = _extension_method_registry
self._extensions = extensions
else:
Expand All @@ -151,7 +151,6 @@ def __init__(
for ext in self._extensions:
self._extension_registry.merge(ext._extension_method_registry)


if TransportClass is None:
TransportClass = DaemonProcessTransport
assert TransportClass is not None
Expand Down

0 comments on commit 47c3b64

Please sign in to comment.