Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 5b485ce

Browse files
author
William McLendon
committed
Merge branch 'remove-dataclass' into 'master'
Remove dataclass See merge request trilinos-devops-consolidation/code/SetProgramOptions!8
2 parents 5cf4fd0 + 3b8dc6d commit 5b485ce

17 files changed

+247
-288
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ ___*
88
*,cover
99
htmlcov
1010
doc/html
11-
src
1211
dist
1312
setconfiguration-dist
1413
*.whl

.style.yapf

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1+
# See: https://github.com/google/yapf#knobs for available options
2+
13
[style]
24
based_on_style = google
35
ARITHMETIC_PRECEDENCE_INDICATION=True
46
blank_lines_around_top_level_definition=3
57
blank_lines_between_top_level_imports_and_variables=2
68
blank_line_before_nested_class_or_def=True
7-
COLUMN_LIMIT=100
89
COALESCE_BRACKETS=False
10+
COLUMN_LIMIT=110
911
DEDENT_CLOSING_BRACKETS=True
10-
INDENT_CLOSING_BRACKETS=True
12+
EACH_DICT_ENTRY_ON_SEPARATE_LINE=True
13+
INDENT_BLANK_LINES=False
14+
INDENT_CLOSING_BRACKETS=False
1115
SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET=True
1216
SPACE_INSIDE_BRACKETS=False
17+
#SPACES_AROUND_DICT_DELIMITERS=True
18+
#SPACES_AROUND_LIST_DELIMITERS=True
1319
SPACES_AROUND_SUBSCRIPT_COLON=True
20+
#SPACES_AROUND_TUPLE_DELIMITERS=True
1421
SPACES_BEFORE_COMMENT=15,30
1522
SPLIT_BEFORE_DOT=True
1623
SPLIT_BEFORE_DICT_SET_GENERATOR=True
1724
SPLIT_COMPLEX_COMPREHENSION=True
1825
SPLIT_ALL_COMMA_SEPARATED_VALUES=False
1926
SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES=True
27+
28+

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
#### Todo (for Unreleased)
1818
-->
1919

20+
## [0.3.1] <!-- YYYY-MM-DD --> [Unreleased]
21+
#### Added
22+
#### Changed
23+
#### Deprecated
24+
#### Removed
25+
#### Fixed
26+
#### Security
27+
#### Internal
28+
- Changed `VariableFieldData` so that it won't use `dataclasses` to keep our
29+
Python compatibilty to 3.6 (`dataclasses` requires 3.7 and higher).
30+
#### Todo (for Unreleased)
31+
2032

2133
## [0.3.0] - 2021-06-15
2234
#### Added

examples/example-01.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python3
2-
import os
3-
import sys
2+
# -*- mode: python; py-indent-offset: 4; py-continuation-offset: 4 -*-
43

54
import setprogramoptions
65

6+
77
filename = "example-01.ini"
88
popts = setprogramoptions.SetProgramOptions(filename)
99

10-
section = "MY_LS_COMMAND"
10+
section = "MY_LS_COMMAND"
1111
popts.parse_section(section)
1212
bash_options = popts.gen_option_list(section, generator="bash")
1313
print(" ".join(bash_options))

examples/example-02.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python3
2-
import os
3-
import sys
2+
# -*- mode: python; py-indent-offset: 4; py-continuation-offset: 4 -*-
43

54
import setprogramoptions
65

6+
77
filename = "example-02.ini"
88
popts = setprogramoptions.SetProgramOptionsCMake(filename)
99

10-
section = "MYPROJ_CONFIGURATION_NINJA"
10+
section = "MYPROJ_CONFIGURATION_NINJA"
1111
popts.parse_section(section)
1212

1313
# Generate BASH output
@@ -25,4 +25,3 @@
2525
print("\n".join(cmake_options))
2626

2727
print("\nDone")
28-

examples/example-03.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#!/usr/bin/env python3
22
# -*- mode: python; py-indent-offset: 4; py-continuation-offset: 4 -*-
3-
"""
4-
Example app for SetProgramOptions
5-
"""
3+
64
import os
75
from pprint import pprint
86

9-
107
import setprogramoptions
118

129

1310

14-
def find_config_ini(filename="config.ini", rootpath="." ):
11+
def find_config_ini(filename="config.ini", rootpath="."):
1512
"""
1613
Recursively searches for a particular file among the subdirectory structure.
1714
If we find it, then we return the full relative path to `pwd` to that file.
@@ -28,12 +25,12 @@ def find_config_ini(filename="config.ini", rootpath="." ):
2825
2926
"""
3027
output = None
31-
for dirpath,dirnames,filename_list in os.walk(rootpath):
28+
for dirpath, dirnames, filename_list in os.walk(rootpath):
3229
if filename in filename_list:
3330
output = os.path.join(dirpath, filename)
3431
break
3532
if output is None:
36-
raise FileNotFoundError("Unable to find {} in {}".format(filename, os.getcwd())) # pragma: no cover
33+
raise FileNotFoundError("Unable to find {} in {}".format(filename, os.getcwd())) # pragma: no cover
3734
return output
3835

3936

@@ -60,7 +57,7 @@ def test_setprogramoptions(filename="config.ini"):
6057
print("Bash Output")
6158
print("-----------")
6259
option_list = parser.gen_option_list(section_name, generator="bash")
63-
print( " \\\n ".join(option_list) )
60+
print(" \\\n ".join(option_list))
6461

6562
print("")
6663
print("CMake Fragment")
@@ -85,13 +82,15 @@ def parse_section(parser, section):
8582
pprint(data, width=120)
8683

8784
# Print the loginfo from the last search (change if to True to enable)
88-
if(False):
85+
if (False):
8986
print("\nLogInfo")
9087
print("-------")
9188
#parser._loginfo_print(pretty=True)
9289

9390
# Filter out just the entry and exits for handlers
94-
handler_list = [ (d['type'], d['name']) for d in parser._loginfo if d['type'] in ['handler-entry','handler-exit']]
91+
handler_list = [
92+
(d['type'], d['name']) for d in parser._loginfo if d['type'] in ['handler-entry', 'handler-exit']
93+
]
9594
pprint(handler_list, width=120)
9695

9796
return data
@@ -112,4 +111,3 @@ def main():
112111
if __name__ == "__main__":
113112
main()
114113
print("Done.")
115-

exec-reformat.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# Source the common helpers script
4+
source scripts/common.bash
5+
6+
printf "${yellow}"
7+
print_banner "Reformatting - Started"
8+
printf "${normal}\n"
9+
10+
exclude_dirs=(
11+
.git
12+
doc
13+
__pycache__
14+
deps
15+
venv-*
16+
)
17+
18+
exclude_opts=()
19+
for exc in ${exclude_dirs[*]}; do
20+
exclude_opts+=("-e")
21+
exclude_opts+=("${exc}")
22+
done
23+
24+
execute_command "yapf -vv -i -p -r ${exclude_opts[*]} ."
25+
26+
printf "${yellow}"
27+
print_banner "Reformatting - Done"
28+
printf "${normal}\n"
29+

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "setprogramoptions"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "Program options helper."
55
authors = [
66
"William McLendon <wcmclen@sandia.gov>"

0 commit comments

Comments
 (0)