intel / cve-bin-tool

The CVE Binary Tool helps you determine if your system includes known vulnerabilities. You can scan binaries for over 200 common, vulnerable components (openssl, libpng, libxml2, expat and others), or if you know the components used, you can get a list of known vulnerabilities associated with an SBOM or a list of components and versions.
https://cve-bin-tool.readthedocs.io/en/latest/
GNU General Public License v3.0
1.19k stars 457 forks source link

docs: add missing docstrings to async_utils.py #3385

Closed terriko closed 11 months ago

terriko commented 11 months ago

We haven't been entirely consistent about adding python docstrings to every function, and I'd like to start improving the codebase. I'm filing separate tickets for each file I want updated so hacktoberfest folk can claim them more easily -- please only claim one or two at a time.

Here's a tutorial on docstrings in case you're not sure what they are. Basically I want someone to write a short sentence explaining what a function does and have it put at the top of the function in the way that python expects docstrings to look. (You can also do classes and methods.)

This issue is for updating the file fetch_json_db.py. interrogate (a tool for checking docstrings) says it's missing the following docstrings:

------------------------------ Detailed Coverage ------------------------------- Name Status
async_utils.py
async_wrap (L46) MISSED
async_wrap.run (L48) MISSED
get_event_loop (L57) MISSED
run_coroutine (L70) MISSED
aio_run_command (L77) MISSED
ChangeDirContext (L91) MISSED
ChangeDirContext.aenter (L96) MISSED
ChangeDirContext.aexit (L99) MISSED
FileIO (L103) MISSED
FileIO.call (L126) COVERED
FileIO.open (L133) MISSED
FileIO._setup (L139) MISSED
FileIO.aenter (L191) MISSED
FileIO.aexit (L194) MISSED
FileIO.anext (L197) MISSED
FileIO.aiter (L204) MISSED
TemporaryFile (L208) MISSED
TemporaryFile._setup (L214) MISSED
NamedTemporaryFile (L219) MISSED
SpooledTemporaryFile (L223) MISSED
GzipFile (L228) MISSED
RateLimiter (L232) COVERED
RateLimiter.get (L250) MISSED
RateLimiter.wait_for_token (L254) MISSED
RateLimiter.add_new_tokens (L260) MISSED
RateLimiter.close (L268) MISSED
------------------------------------------------------------------- ----------

You will need to actually read the file and figure out what it does, then describe each function. Feel free to ask questions if you're not sure, or submit a partial fix where you only add docstrings to some functions.

Short tips for new contributors:

Claiming issues:

pranshu-raj-211 commented 11 months ago

Hi could I work on this issue?

terriko commented 11 months ago

@Kaito117 I've assigned it to you! Let us know if you get stuck. This particular file is missing more docstrings than most!

SuryaCreatX commented 11 months ago

Please assign me this issue?

pranshu-raj-211 commented 11 months ago

@SuryaCreatX I'm still working on the issue.

NabhiA commented 11 months ago

@Kaito117 Hello ! Are you still working on the issue ?

pranshu-raj-211 commented 11 months ago

@NabhiA Yes! My internet connection was cut off for more than a week, so I was not able to look up some parts I'm having issues with. I'll submit a PR within a day.

terriko commented 11 months ago

Closed with #3442