I tried with the module inspect
but could not get the result.
The concept is: "scan" a file through a decorator
.
Steps
file
before function read_file
will be called decorator
I have tried in several ways and I agree that I did not find any way to do this, even using the inspect
module of the Standard Python library.
def scan_files(funcs):
print(funcs.__code__.co_varnames)
return funcs
@scan_files
def read_file():
file = open('arquivo.txt', 'w')
file.close()
with open('arquivo.txt', 'w') as new_file: ...
PS: for reasons of readability omit some factors, such as, functions with named arguments or not, variable not having the fixed name being necessary to know the type considered as object file.