aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislav Boboň2020-10-20 14:36:44 +0200
committerStanislav Boboň2020-10-20 14:41:06 +0200
commit290eb267156fed196d7453d98870dbd85c2fd26f (patch)
tree324b21c8ab8f8153690fcc61e13d93af92b5ef9b
parent675d119e73392038a56ac267428d7a8f227c715b (diff)
downloadsec-certs-290eb267156fed196d7453d98870dbd85c2fd26f.tar.gz
sec-certs-290eb267156fed196d7453d98870dbd85c2fd26f.tar.zst
sec-certs-290eb267156fed196d7453d98870dbd85c2fd26f.zip
fstrings and comments
-rw-r--r--sec_certs/download_files.py0
-rwxr-xr-xsec_certs/fips_certificates.py11
2 files changed, 5 insertions, 6 deletions
diff --git a/sec_certs/download_files.py b/sec_certs/download_files.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/sec_certs/download_files.py
diff --git a/sec_certs/fips_certificates.py b/sec_certs/fips_certificates.py
index 5aee70af..52220013 100755
--- a/sec_certs/fips_certificates.py
+++ b/sec_certs/fips_certificates.py
@@ -79,7 +79,7 @@ def parse_algorithms(text, in_pdf=False):
@return: list of all found algorithm IDs
"""
items_found = []
- for m in re.finditer(r"(?:#{}\s?|Cert\.?[^. ]*?\s?)(?:[Cc]\s)?(?P<id>\d+)".format('?' if in_pdf else ''), text):
+ for m in re.finditer(rf"(?:#{'?' if in_pdf else ''}\s?|Cert\.?[^. ]*?\s?)(?:[Cc]\s)?(?P<id>\d+)", text):
items_found.append({'Certificate': m.group()})
return items_found
@@ -115,9 +115,9 @@ def initialize_entry(input_dictionary):
def fips_search_html(base_dir, output_file, dump_to_file=False):
"""fips_search_html.
- :param base_dir: directory to search for html files
- :param output_file: file to dump json to
- :param dump_to_file: True/False
+ @param base_dir: directory to search for html files
+ @param output_file: file to dump json to
+ @param dump_to_file: True/False
"""
all_found_items = {}
@@ -133,7 +133,6 @@ def fips_search_html(base_dir, output_file, dump_to_file=False):
for rule in RE_FIPS_HTMLS:
m = re.search(rule, text)
if m is None:
- # print("ERROR: For rule {} nothing found in file {}.".format(rule, file))
continue
group_dict = m.groupdict()
@@ -238,7 +237,7 @@ def get_dot_graph(found_items, output_file_name):
dot.edge(key, conn)
edges += 1
- print("rendering {} keys and {} edges".format(keys, edges))
+ print(f"rendering {keys} keys and {edges} edges")
dot.render(output_file_name + 'connections', view=True)
single_dot.render(output_file_name + 'single', view=True)