mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 03:55:22 +00:00
Merge e77cd6f8225e9bb988d107ac1679ad37a1135a96 into b3d0b4443baf5da952f3135bd017ff1e60e654bb
This commit is contained in:
commit
1a940a07b4
@ -178,8 +178,11 @@ def get_file_extensions():
|
|||||||
|
|
||||||
def read_file_content(file_name: str, encoding="utf-8"):
|
def read_file_content(file_name: str, encoding="utf-8"):
|
||||||
if file_ext_is_allowed(file_name, DEFAULT_EXTENSIONS):
|
if file_ext_is_allowed(file_name, DEFAULT_EXTENSIONS):
|
||||||
with open(file_name, "r", encoding=encoding) as f:
|
try:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
|
except Exception as e:
|
||||||
|
logging.debug("Encountered exception when attempting to decode: {0}".format(file_name))
|
||||||
|
raise e
|
||||||
elif file_ext_is_allowed(file_name, [".ipynb"]) and scan_noteboooks:
|
elif file_ext_is_allowed(file_name, [".ipynb"]) and scan_noteboooks:
|
||||||
contents = ipynb_2_py(file_name, encoding=encoding)
|
contents = ipynb_2_py(file_name, encoding=encoding)
|
||||||
return contents
|
return contents
|
||||||
|
Loading…
x
Reference in New Issue
Block a user