mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-06 03:25:21 +00:00
Cleanup
Moved the import statement to the top of the page where it belongs
This commit is contained in:
parent
60983f0fde
commit
415ede7691
@ -23,7 +23,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import codecs
|
import codecs
|
||||||
|
import ast, traceback
|
||||||
from docopt import docopt
|
from docopt import docopt
|
||||||
import requests
|
import requests
|
||||||
from yarg import json2package
|
from yarg import json2package
|
||||||
@ -42,8 +42,6 @@ else:
|
|||||||
open_func = codecs.open
|
open_func = codecs.open
|
||||||
|
|
||||||
|
|
||||||
import ast, traceback
|
|
||||||
|
|
||||||
def get_all_imports(path, encoding=None):
|
def get_all_imports(path, encoding=None):
|
||||||
imports = set()
|
imports = set()
|
||||||
raw_imports = set()
|
raw_imports = set()
|
||||||
@ -60,6 +58,9 @@ def get_all_imports(path, encoding=None):
|
|||||||
for file_name in files:
|
for file_name in files:
|
||||||
with open_func(os.path.join(root, file_name), "r", encoding=encoding) as f:
|
with open_func(os.path.join(root, file_name), "r", encoding=encoding) as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
|
#contents = re.sub(re.compile("'''.+?'''", re.DOTALL), '', f.read())
|
||||||
|
#contents = re.sub(re.compile('""".+?"""', re.DOTALL), "", contents)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tree = ast.parse(contents)
|
tree = ast.parse(contents)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user