Skip to content

Commit

Permalink
fix: init subclass docstring formatting for iterators (#462)
Browse files Browse the repository at this point in the history
* fix: init subclass docstring formatting for iterators

* fix: init subclass docstring formatting for iterators

* fix: init subclass docstring formatting for iterators
  • Loading branch information
BobTheBuidler authored Nov 30, 2024
1 parent 993f719 commit ffb6bbe
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion a_sync/iter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,22 @@ class _AwaitableAsyncIterableMixin(AsyncIterable[T]):
# argdefs=function_obj.__defaults__,
# closure=function_obj.__closure__,
#)
redefined_function_obj = deepcopy(function_obj)
redefined_function_obj = None
if hasattr(_AwaitableAsyncIterableMixin, function_name):
base_definition = getattr(_AwaitableAsyncIterableMixin, function_name)
if function_obj.__doc__ == base_definition.__doc__:
redefined_function_obj = deepcopy(base_definition)
elif cls.__name__ != "ASyncIterable" and hasattr(ASyncIterable, function_name):
base_definition = getattr(ASyncIterable, function_name)
if function_obj.__doc__ == base_definition.__doc__:
redefined_function_obj = deepcopy(base_definition)
elif cls.__name__ not in ("ASyncIterable", "ASyncIterator") and hasattr(ASyncIterator, function_name):
base_definition = getattr(ASyncIterator, function_name)
if function_obj.__doc__ == base_definition.__doc__:
redefined_function_obj = deepcopy(base_definition)
if redefined_function_obj is None:
redefined_function_obj = deepcopy(function_obj)
redefined_function_obj.__doc__ = function_obj.__doc__.format(
cls=cls.__name__,
Expand Down

0 comments on commit ffb6bbe

Please sign in to comment.