Skip to content
Permalink
Browse files

remove empty __init__.py

  • Loading branch information...
sdpython committed Dec 13, 2014
1 parent 5851ad7 commit cb7fb4400e37a5b34e774afe55548f7e5b2600fc
Showing with 12 additions and 11 deletions.
  1. +12 −11 src/pyquickhelper/helpgen/utils_sphinx_doc.py
@@ -122,7 +122,7 @@ def _private_process_one_file(fullname, to, silent, fmod, replace_relative_impor
@param fmod modification functions
@param replace_relative_import replace relative import
@return extension, number of lines
.. versionchanged:: 0.9
return extension, number of lines
"""
@@ -142,7 +142,7 @@ def _private_process_one_file(fullname, to, silent, fmod, replace_relative_impor
with open(fullname, "r", encoding="utf8") as g : content = g.read()
except UnicodeDecodeError:
with open(fullname, "r") as g : content = g.read()

lines = [ _.strip(" \t\n\r") for _ in content.split("\n") ]
lines = [ _ for _ in lines if len(_) > 0 ]
nblines = len(lines)
@@ -163,7 +163,7 @@ def _private_process_one_file(fullname, to, silent, fmod, replace_relative_impor
if replace_relative_import:
content = replace_relative_import(fullname, content)
with open(to, "w", encoding="utf8") as g : g.write(content)

return os.path.splitext(fullname)[-1], nblines

def remove_undesired_part_for_documentation(content, filename):
@@ -265,7 +265,7 @@ def copy_source_files ( input,
if file.name.endswith("setup.py") : continue
if "setup.py" in file.name :
raise FileNotFoundError("are you sure (setup.py)?, file: " + file.fullname)

to = os.path.join(dest, file.name)
dd = os.path.split(to)[0]
if not os.path.exists (dd) :
@@ -801,7 +801,7 @@ def prepare_file_for_sphinx_help_generation (
optional_dirs = optional_dirs,
mapped_function = [ (".*[.]tohelp$", None) ] )
@endcode
.. versionchanged:: 0.9
produce a file with the number of lines and files per extension
"""
@@ -823,7 +823,7 @@ def prepare_file_for_sphinx_help_generation (

if os.path.isfile(src) :
_private_process_one_file(src, dst, silent, fmod_copy)

temp = os.path.split(dst)
actions_t = [ (">", temp[1], temp[0]) ]
rstadd = add_file_rst ( rootm,
@@ -902,16 +902,17 @@ def prepare_file_for_sphinx_help_generation (
with open(out, "w", encoding="utf8") as f :
f.write(v)
rsts.append ( RstFileHelp (None, out, None) )

# geneates a table with the number of lines per extension
rows = []
for act in actions:
v = 1 if act[-1] > 0 else 0
rows.append ( act[-2:] + (v,) )
if "__init__.py" not in act[1].get_fullname() or act[-1] > 0 :
v = 1
rows.append ( act[-2:] + (v,) )
from pandas import DataFrame
df = DataFrame(data=rows, columns=["extension", "nb lines", "nb files"])
df = df.groupby("extension", as_index=False).sum().sort("extension")

all_report = os.path.join(output, "all_report.rst")
with open(all_report,"w") as falli :
falli.write("\n")
@@ -924,7 +925,7 @@ def prepare_file_for_sphinx_help_generation (
falli.write(sph)
falli.write("\n")
rsts.append( RstFileHelp(None, all_report, None))

# all indexes
all_index = os.path.join(output, "all_indexes.rst")
with open(all_index,"w") as falli :

0 comments on commit cb7fb44

Please sign in to comment.
You can’t perform that action at this time.