Skip to content

Commit e461163

Browse files
authored
Merge pull request #162 from strictdoc-project/stanislaw/actions
CI: update Python action version
2 parents 7c10d89 + e5c15ba commit e461163

48 files changed

Lines changed: 217 additions & 446 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v1
21+
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

.github/workflows/ci-mac.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: macOS-latest
11+
runs-on: macos-13
1212

1313
strategy:
1414
matrix:
1515
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v1
21+
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

.github/workflows/ci-windows.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@ jobs:
1515
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
20-
- name: "Print Debug info"
21-
run: |
22-
echo $env:USERPROFILE
23-
echo $env:PATH
24-
echo "$PWD"
18+
- uses: actions/checkout@v4
2519

2620
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v1
21+
uses: actions/setup-python@v5
2822
with:
2923
python-version: ${{ matrix.python-version }}
3024

reqif/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
__version__ = "0.0.41"
44

5-
PATH_TO_REQIF_ROOT = os.path.abspath(
6-
os.path.join(os.path.dirname(__file__), os.pardir)
7-
)
5+
PATH_TO_REQIF_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))

reqif/cli/cli_arg_parser.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ def formatter(prog):
1111
main_parser = argparse.ArgumentParser()
1212
main_parser.formatter_class = formatter
1313

14-
command_subparsers = main_parser.add_subparsers(
15-
title="command", dest="command"
16-
)
14+
command_subparsers = main_parser.add_subparsers(title="command", dest="command")
1715
command_subparsers.required = True
1816

1917
# Command – Passthrough
@@ -60,10 +58,7 @@ def formatter(prog):
6058
# Command – Format
6159
command_parser_format = command_subparsers.add_parser(
6260
"format",
63-
help=(
64-
"Read a ReqIF file and pretty-print its contents to "
65-
"an output file."
66-
),
61+
help=("Read a ReqIF file and pretty-print its contents to " "an output file."),
6762
formatter_class=formatter,
6863
)
6964
command_parser_format.add_argument(
@@ -169,14 +164,10 @@ def get_convert_config(self) -> ConvertCommandConfig:
169164
return ConvertCommandConfig(self.args.input_file, self.args.output_file)
170165

171166
def get_passthrough_config(self) -> PassthroughCommandConfig:
172-
return PassthroughCommandConfig(
173-
self.args.input_file, self.args.output_file
174-
)
167+
return PassthroughCommandConfig(self.args.input_file, self.args.output_file)
175168

176169
def get_anonymize_config(self) -> AnonimizeCommandConfig:
177-
return AnonimizeCommandConfig(
178-
self.args.input_file, self.args.output_file
179-
)
170+
return AnonimizeCommandConfig(self.args.input_file, self.args.output_file)
180171

181172
def get_dump_config(self) -> DumpCommandConfig:
182173
return DumpCommandConfig(self.args.input_file, self.args.output_file)
@@ -185,9 +176,7 @@ def get_format_config(self) -> FormatCommandConfig:
185176
return FormatCommandConfig(self.args.input_file, self.args.output_file)
186177

187178
def get_validate_config(self) -> ValidateCommandConfig:
188-
return ValidateCommandConfig(
189-
self.args.input_file, self.args.use_reqif_schema
190-
)
179+
return ValidateCommandConfig(self.args.input_file, self.args.use_reqif_schema)
191180

192181

193182
def create_reqif_args_parser(testing_args=None) -> ReqIFArgsParser:

reqif/cli/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import sys
33

44
try:
5-
ROOT_PATH = os.path.abspath(
6-
os.path.join(os.path.dirname(__file__), "..", "..")
7-
)
5+
ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
86
if not os.path.isdir(ROOT_PATH):
97
raise FileNotFoundError(ROOT_PATH)
108
sys.path.append(ROOT_PATH)

reqif/commands/anonymize/anonymize.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
def anonymize_string(string: str) -> str:
2121
# https://stackoverflow.com/a/42089311/598057
22-
hash_number = (
23-
int(hashlib.sha256(string.encode("utf8")).hexdigest(), 16) % 10**10
24-
)
22+
hash_number = int(hashlib.sha256(string.encode("utf8")).hexdigest(), 16) % 10**10
2523
return "..." + ANONYMIZED + "-" + str(hash_number) + "..."
2624

2725

@@ -80,9 +78,7 @@ def _anonymize(config: AnonimizeCommandConfig):
8078
)
8179

8280
# Clear out all SPECIFICATION names.
83-
xml_specifications = xml_reqif.xpath(
84-
"//reqif:SPECIFICATION", namespaces=fixns
85-
)
81+
xml_specifications = xml_reqif.xpath("//reqif:SPECIFICATION", namespaces=fixns)
8682
for xml_specification in xml_specifications:
8783
if "LONG-NAME" in xml_specification.attrib:
8884
xml_specification.attrib["LONG-NAME"] = anonymize_string(
@@ -95,9 +91,7 @@ def _anonymize(config: AnonimizeCommandConfig):
9591
)
9692
for xml_attribute_value_string in xml_attribute_value_strings:
9793
if "THE-VALUE" in xml_attribute_value_string.attrib:
98-
xml_attribute_value_string.attrib[
99-
"THE-VALUE"
100-
] = anonymize_string(
94+
xml_attribute_value_string.attrib["THE-VALUE"] = anonymize_string(
10195
xml_attribute_value_string.attrib["THE-VALUE"]
10296
)
10397

@@ -106,8 +100,8 @@ def _anonymize(config: AnonimizeCommandConfig):
106100
"//reqif:ATTRIBUTE-VALUE-XHTML/reqif:THE-VALUE", namespaces=fixns
107101
)
108102
for xml_attribute_value_xhtml in xml_attribute_value_xhtmls:
109-
xml_attribute_value_xhtml_text: str = (
110-
lxml_stringify_namespaced_children(xml_attribute_value_xhtml)
103+
xml_attribute_value_xhtml_text: str = lxml_stringify_namespaced_children(
104+
xml_attribute_value_xhtml
111105
)
112106
for child in list(xml_attribute_value_xhtml):
113107
xml_attribute_value_xhtml.remove(child)

reqif/commands/passthrough/passthrough.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def _passthrough(passthrough_config: PassthroughCommandConfig) -> bytes:
4545
def _passthrough_reqifz(
4646
passthrough_config: PassthroughCommandConfig,
4747
) -> bytes:
48-
reqifz_bundle: ReqIFZBundle = ReqIFZParser.parse(
49-
passthrough_config.input_file
50-
)
48+
reqifz_bundle: ReqIFZBundle = ReqIFZParser.parse(passthrough_config.input_file)
5149
reqifz_output = ReqIFZUnparser.unparse(reqifz_bundle)
5250
return reqifz_output

reqif/commands/validate/validate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ def _validate_specifications(
194194
for hierarchy in reqif_bundle.iterate_specification_hierarchy(
195195
specification
196196
):
197-
if not reqif_bundle.lookup.spec_object_exists(
198-
hierarchy.spec_object
199-
):
197+
if not reqif_bundle.lookup.spec_object_exists(hierarchy.spec_object):
200198
warnings.append(
201199
ReqIFSpecHierarchyMissingSpecObjectException(
202200
xml_node=hierarchy.xml_node,

reqif/experimental/reqif_schema.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ def __init__(self, reqif_bundle: ReqIFBundle):
1919
spec_object_type_attributes: Dict[str, SpecAttributeDefinition] = {}
2020
spec_object_type_names: Dict[str, str] = {}
2121
detected_section_spec_type: Optional[ReqIFSpecObjectType] = None
22-
detected_chapter_name_attribute: Optional[
23-
SpecAttributeDefinition
24-
] = None
22+
detected_chapter_name_attribute: Optional[SpecAttributeDefinition] = None
2523
detected_schema_type: ReqIFSchema.ReqIFSchemaType = (
2624
ReqIFSchema.ReqIFSchemaType.DEFAULT
2725
)
@@ -47,27 +45,25 @@ def __init__(self, reqif_bundle: ReqIFBundle):
4745
for attribute_definition in spec_type.attribute_definitions:
4846
if attribute_definition.long_name == "ReqIF.ChapterName":
4947
detected_chapter_name_attribute = attribute_definition
50-
spec_object_type_attributes[
51-
attribute_definition.identifier
52-
] = attribute_definition
48+
spec_object_type_attributes[attribute_definition.identifier] = (
49+
attribute_definition
50+
)
5351

5452
assert reqif_bundle.core_content.req_if_content.data_types is not None
5553
for data_type in reqif_bundle.core_content.req_if_content.data_types:
5654
data_type_definitions[data_type.identifier] = data_type
5755

5856
self.data_type_definitions: Dict[str, Any] = data_type_definitions
59-
self.spec_object_type_attributes: Dict[
60-
str, SpecAttributeDefinition
61-
] = spec_object_type_attributes
57+
self.spec_object_type_attributes: Dict[str, SpecAttributeDefinition] = (
58+
spec_object_type_attributes
59+
)
6260
self.spec_object_type_names: Dict[str, str] = spec_object_type_names
6361
self.reqif_bundle: ReqIFBundle = reqif_bundle
6462
self.detected_heading_spec_type = detected_section_spec_type
65-
self.detected_chapter_name_attribute: Optional[
66-
SpecAttributeDefinition
67-
] = detected_chapter_name_attribute
68-
self.detected_schema_type: ReqIFSchema.ReqIFSchemaType = (
69-
detected_schema_type
63+
self.detected_chapter_name_attribute: Optional[SpecAttributeDefinition] = (
64+
detected_chapter_name_attribute
7065
)
66+
self.detected_schema_type: ReqIFSchema.ReqIFSchemaType = detected_schema_type
7167

7268
def is_spec_object_a_heading(self, spec_object: ReqIFSpecObject):
7369
if self.detected_heading_spec_type is not None:
@@ -92,4 +88,7 @@ def iterate_unique_field_names(self):
9288
if attribute_definition_.long_name in unique_names_so_far:
9389
continue
9490
unique_names_so_far.add(attribute_definition_.long_name)
95-
yield attribute_definition_.long_name, attribute_definition_.attribute_type.name
91+
yield (
92+
attribute_definition_.long_name,
93+
attribute_definition_.attribute_type.name,
94+
)

0 commit comments

Comments
 (0)