"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "beautysh/beautysh.py" between
beautysh-5.0.2.tar.gz and beautysh-6.0.1.tar.gz

About: beautysh is a beautifier for Bash shell scripts.

beautysh.py  (beautysh-5.0.2):beautysh.py  (beautysh-6.0.1)
skipping to change at line 48 skipping to change at line 48
self.check_only = False self.check_only = False
self.apply_function_style = None # default is no change based on functio n style self.apply_function_style = None # default is no change based on functio n style
def read_file(self, fp): def read_file(self, fp):
"""Read input file.""" """Read input file."""
with open(fp) as f: with open(fp) as f:
return f.read() return f.read()
def write_file(self, fp, data): def write_file(self, fp, data):
"""Write output to a file.""" """Write output to a file."""
with open(fp, 'w') as f: with open(fp, 'w', newline='\n') as f:
f.write(data) f.write(data)
def detect_function_style(self, test_record): def detect_function_style(self, test_record):
"""Returns the index for the function declaration style detected in the given string """Returns the index for the function declaration style detected in the given string
or None if no function declarations are detected.""" or None if no function declarations are detected."""
index = 0 index = 0
# IMPORTANT: apply regex sequentially and stop on the first match: # IMPORTANT: apply regex sequentially and stop on the first match:
for regex in FUNCTION_STYLE_REGEX: for regex in FUNCTION_STYLE_REGEX:
if re.search(regex, test_record): if re.search(regex, test_record):
return index return index
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)