mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #1115] Improve 'util.py' with function docstrings #661
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#661
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dianna-SE on GitHub (May 22, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1115
Description of feature request
I was analyzing this file for a course in my post-baccalaureate program and conducted several tests, but found it difficult to understand the function's purpose, parameters, and variables. Following basic coding style guidelines, there is an inconsistency with function docstrings (only one docstring was included for a function but not the rest). The lack of documentation made it difficult to work/test with the code.
Solution description
Maintain consistency with function docstrings and provide clear details that describe the function's purpose, parameters, return values, and error handling, if any.
Alternatives considered
I tried to read through the code and ran tests, but it was time-consuming to read through the code to try to understand the function's purpose. This resulted in slight errors and delayed the time to conduct thorough testing.
Additional context
Improving the documentation of the functions will improve readability and allow other users to better understand and maintain the code, especially for testing.
@dieser-niko commented on GitHub (May 23, 2024):
This can be explained somewhat easily, as the functions aren't that big.
normalize_scopemakes sure that the input is a list/tuple. If the input (scope) is a string, it splits the string by commas to create a list of scopes. If the scope is already a list or tuple, it uses it directly.get_host_portsplits something like"localhost:8080"into host and port and returns it as a tuple("localhost", 8080). If no port is given, then it returns("localhost", None).But I have to agree with you, docstrings should be mandatory for every function.
@dianna-SE commented on GitHub (May 24, 2024):
I think your explanation sums up as a great docstring explanation for these functions actually! They are simple but beginners or developers unfamiliar with Python would find them incredibly helpful.
@dieser-niko commented on GitHub (May 24, 2024):
I think you meant Python instead of JavaScript
@dianna-SE commented on GitHub (May 25, 2024):
Updated the comment! Thanks for the catch.