Searching (Verison 2)

A module used to find a file, or multiple files in

from src.PythonFunctions import Searching
sch = Searching.search()

Locate

Locate(target, *, directory, layers, hidden, logging):

Find a file with some paramters to help search for it.

Parameters
  • target (List[str]) – File to find.

  • directory (str) – Directory to search in. Defaults to current run directory (“.”).

  • layers (int) – How many layers above the specified directory to go. Defaults to 2.

  • hidden (List[str]) – Limit the search by not searching these files / folders. Defaults to [].

  • logging (bool) – To output what file in what folder is currently being searched. Defaults to False.

Returns

The location of target

Return type

List[str]

Note

The hidden pararmater actually takes data from the clean module!

result = sch.Locate("Watermark.py", layers=0, hidden=[".venv", "*.pyc", "docs", "dist", "typings"], logging=True)
print(result)

Clear

Clear()

Reset the class so you can use the same class but get different result. Should only be used if it isn’t done automatically.