democritus-project / democritus-project/d8s-python

Update "python_file_names" function to have "recursive" boolean argument

Open
#30 0 comments 0 reactions 1 assignee Claimed by @fhightower View on GitHub
enhancement time est: 1 hour
Dominant language
Python
Stars
2
Forks
4
PR merge metrics
No merged PRs in 30d

Description

I don't have time right now to scope this out entirely, but I would like to create a `python_files` function that lets a user find python files in a given directory. The function should be very similar to the [`python_file_names` function](https://github.com/democritus-project/d8s-python/blob/4e5e8178b9dfda8f3752a53042c58c1e95ecfd19/d8s_python/python_data.py#L251) and should take a `recursive` kwarg as well as a `return_file_paths` kwarg which determines whether file names or file paths are returned.

In the future, I can update this issue to have the text below:

---

HELP WANTED 👋 : If you'd like to take this challenge on, please let me know! Even if you're new to Python and/or Github, this is a great place to start and I'd be happy to help walk you through this challenge as much as you need - don't hesitate to ask.

This particular issue will give you some exposure to updating a function's arguments, using [type hints](https://docs.python.org/3/library/typing.html) in Python, and the [Pathlib](https://docs.python.org/3/library/pathlib.html) library.

---

# What?

We should update the [`python_file_names` function](https://github.com/democritus-project/d8s-python/blob/4e5e8178b9dfda8f3752a53042c58c1e95ecfd19/d8s_python/python_data.py#L251) to have a boolean `recursive` argument that lets the user specify whether or not he/she would like to search for Python files in the given directory recursively or not. The function signature is currently:

```python
python_file_names(path: str, *, exclude_tests: bool = False) -> List[str]:
```

but should be updated to:

```python
python_file_names(path: str, *, exclude_tests: bool = False, recursive: bool = False) -> List[str]:
```

# Why?

# How?

# Additional thoughts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.