Skip to content

Commit

Permalink
better structure
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Sep 24, 2015
1 parent f528aad commit c5dcafc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/admin_scripts/base/stylesheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@

import admin_scripts.extra as extra

USAGE_MESSAGE = "cleanup-stylesheets-python path [-r] [-u] [-n] [-p property_name_1, property_name_2, ...] [-s rule_skip_1, rule_skip_2, ...] [-e file_extension_1, file_extension_2, ...] [-w exclusion_1, exclusion_2, ...] [-c configuration_file]"
USAGE_MESSAGE = "cleanup-stylesheets-python path [-r] [-u] [-n]\
[-p property_name_1, property_name_2, ...]\
[-s rule_skip_1, rule_skip_2, ...]\
[-e file_extension_1, file_extension_2, ...]\
[-w exclusion_1, exclusion_2, ...]\
[-c configuration_file]"
""" The usage message """

COLOR_REGEX_VALUE = r"(.*:)(.*#)([0-9a-fA-F]+)(.*)"
Expand Down Expand Up @@ -198,7 +203,8 @@ def process_property_lines(property_lines, line_number):
"""

# processes the property lines
processed_property_lines = [process_property_line(property_line, line_number) for property_line in property_lines]
processed_property_lines = [process_property_line(property_line, line_number)\
for property_line in property_lines]

# returns the processed property lines
return processed_property_lines
Expand Down Expand Up @@ -249,13 +255,10 @@ def process_color_definition(property_line, line_number):
property_name, pre_color, color, post_color = line_groups

try:
# fixes the color
# runs the fixing color operation and then, re-joins the
# various groups again into a single string (from list)
color = fix_color(color)

# packs the line groups
line_groups = [property_name, pre_color, color, post_color]

# assembles the line with the fixed color
property_line = "".join(line_groups)
except Exception as exception:
# converts the exception to string and then
Expand Down Expand Up @@ -425,16 +428,13 @@ def cleanup_properties(input_buffer, windows_newline, fix_extra_newlines, proper
# updates the flag to signal the rule has ended
rule_started = False

# property lines
# sorts the various property lines and the processes them
property_lines = sorted(rule_lines, key = get_comparison_key)

# processes the property lines
property_lines = process_property_lines(property_lines, line_number)

# writes the lines to the buffer, considering the windows newline
# and then writes the line
write_lines(output_buffer, property_lines, windows_newline)

# writes the line
write_line(output_buffer, line, windows_newline)

# writes the final newline
Expand Down
5 changes: 4 additions & 1 deletion src/admin_scripts/base/trailing_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@

import admin_scripts.extra as extra

USAGE_MESSAGE = "remove-trailing-spaces-python path [-r] [-t] [-n] [-u] [-e file_extension_1, file_extension_2, ...] [-w exclusion_1, exclusion_2, ...] [-c configuration_file]"
USAGE_MESSAGE = "remove-trailing-spaces-python path [-r] [-t] [-n] [-u]\
[-e file_extension_1, file_extension_2, ...]\
[-w exclusion_1, exclusion_2, ...]\
[-c configuration_file]"
""" The usage message """

SPACE_TAB = b" "
Expand Down

0 comments on commit c5dcafc

Please sign in to comment.