1
0
mirror of https://github.com/daknuett/licor synced 2024-07-20 12:15:24 +00:00

renamed misleading function names

This commit is contained in:
Daniel Knuettel 2017-12-29 00:08:18 +01:00
parent 41fb733369
commit 5aae1ba847
2 changed files with 11 additions and 11 deletions

View File

@ -34,9 +34,9 @@
# Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>. # Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
from .work import work_all, work_this_path from .work import work_all, work_this_path
from .templates import get_license_meta, format_license_template, get_templates_available from .templates import get_template_meta, format_template, get_templates_available
from .comment import uncomment_line_based, uncomment_multiline_line_oriented, uncomment_multiline_block_oriented from .comment import uncomment_line_based, uncomment_multiline_line_oriented, uncomment_multiline_block_oriented
import os import os, sys
from .io import insert_header, check_file_perm from .io import insert_header, check_file_perm
db_filename = ".licor.list" db_filename = ".licor.list"
@ -93,13 +93,13 @@ def list_db(path):
def print_uncommented_line_based(license_name, modifiers, data, def print_uncommented_line_based(license_name, modifiers, data,
comment_start, fancy = False, after_comment = " ", pad_to = 0): comment_start, fancy = False, after_comment = " ", pad_to = 0):
data = format_license_template(license_name, data, modifiers) data = format_template(license_name, data, modifiers)
print(uncomment_line_based(data, comment_start, fancy = fancy, print(uncomment_line_based(data, comment_start, fancy = fancy,
after_comment = after_comment, pad_to = pad_to)) after_comment = after_comment, pad_to = pad_to))
def print_uncommented_block_based(license_name, modifiers, data, def print_uncommented_block_based(license_name, modifiers, data,
comment_start, comment_stop, method = "line", border = "*", fancy = False, after_comment = " ", pad_to = 0): comment_start, comment_stop, method = "line", border = "*", fancy = False, after_comment = " ", pad_to = 0):
data = format_license_template(license_name, data, modifiers) data = format_template(license_name, data, modifiers)
if(method == "block"): if(method == "block"):
print(uncomment_multiline_block_oriented(data, print(uncomment_multiline_block_oriented(data,
@ -143,7 +143,7 @@ def insert_templates_all(path, file_ending, ignore_paths, license_name, modifier
callbacks = [] callbacks = []
data = format_license_template(license_name, data, modifiers) data = format_template(license_name, data, modifiers)
if(format_ == "line"): if(format_ == "line"):
text = uncomment_line_based(data, comment_start, fancy = fancy, text = uncomment_line_based(data, comment_start, fancy = fancy,
after_comment = after_comment, pad_to = pad_to) + "\n\n" after_comment = after_comment, pad_to = pad_to) + "\n\n"

View File

@ -47,7 +47,7 @@ def get_resource_string(name):
return pkg_resources.resource_string(__name__,"templates/" + name).decode("UTF-8") return pkg_resources.resource_string(__name__,"templates/" + name).decode("UTF-8")
def get_license_template(name, modifiers = []): def get_template(name, modifiers = []):
""" """
Return a ``dict`` containing all necessary information for Return a ``dict`` containing all necessary information for
filling a license template:: filling a license template::
@ -61,7 +61,7 @@ def get_license_template(name, modifiers = []):
``modifiers`` is a list specifying the template. ``modifiers`` is a list specifying the template.
A typical call might be:: A typical call might be::
get_license_template("AGPL", modifiers = ["single-file"]) get_template("AGPL", modifiers = ["single-file"])
""" """
templates_avail = json.loads(get_resource_string("licenses_avail.json")) templates_avail = json.loads(get_resource_string("licenses_avail.json"))
@ -94,7 +94,7 @@ def get_license_template(name, modifiers = []):
raise TemplateException("Database licenses_avail.json is desynced. Unable to locate resource.") raise TemplateException("Database licenses_avail.json is desynced. Unable to locate resource.")
def get_license_meta(name, modifiers = []): def get_template_meta(name, modifiers = []):
""" """
Return a ``dict`` containing all necessary information for Return a ``dict`` containing all necessary information for
filling a license template:: filling a license template::
@ -107,7 +107,7 @@ def get_license_meta(name, modifiers = []):
``modifiers`` is a list specifying the template. ``modifiers`` is a list specifying the template.
A typical call might be:: A typical call might be::
get_license_meta("AGPL", modifiers = ["single-file"]) get_template_meta("AGPL", modifiers = ["single-file"])
""" """
templates_avail = json.loads(get_resource_string("licenses_avail.json")) templates_avail = json.loads(get_resource_string("licenses_avail.json"))
@ -136,12 +136,12 @@ def get_license_meta(name, modifiers = []):
raise TemplateException("Database licenses_avail.json is desynced. Unable to locate resource.") raise TemplateException("Database licenses_avail.json is desynced. Unable to locate resource.")
def format_license_template(name, data, modifiers = []): def format_template(name, data, modifiers = []):
""" """
Return a formatted version of the license Template. Return a formatted version of the license Template.
This text is ready to be uncommented an placed into a source file. This text is ready to be uncommented an placed into a source file.
""" """
template = get_license_template(name, modifiers) template = get_template(name, modifiers)
missing = [k for k in template["keywords"] if not k in data] missing = [k for k in template["keywords"] if not k in data]
if(missing): if(missing):