Skip to content

Commit d27d515

Browse files
committed
Comply with flake8
1 parent f6169f2 commit d27d515

File tree

7 files changed

+19
-29
lines changed

7 files changed

+19
-29
lines changed

src/fosslight_android/_binary_db_controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def get_oss_info_from_db(platform_version, bin_info_list, return_list):
5151
bin_file_name = os.path.basename(bin_file)
5252
# Get OSS Information From Binary DB by matching checksum , filename, tlsh
5353
df_result, item_comment, is_new = get_oss_info_by_tlsh_and_filename(bin_file_name,
54-
checksum_value, tlsh_value,
55-
item.source_code_path,
56-
platform_version, conn, cur)
54+
checksum_value, tlsh_value,
55+
item.source_code_path,
56+
platform_version, conn, cur)
5757
item.set_comment(item_comment)
5858
item.is_new_bin = is_new
5959
if df_result is not None and len(df_result) > 0:

src/fosslight_android/_common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def __init__(self, value):
6060
self.additional_oss_items = []
6161
self.is_new_bin = True
6262

63-
6463
def __del__(self):
6564
pass
6665

src/fosslight_android/_help.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
Usage: fosslight_android [option1] <arg1> [option2] <arg2>...
99
1010
List all the binaries loaded on the Android-based model to check which open source is used for each
11-
binary, and to check whether the notices are included in the OSS notice.
11+
binary, and to check whether the notices are included in the OSS notice.
1212
(ex-NOTICE.html: OSS Notice for Android-based model).
1313
1414
Options:
1515
Mandatory
1616
-s <android_source_path>\t Path to analyze
17-
-a <build_log_file_name>\t The file must be located in the android source path.
17+
-a <build_log_file_name>\t The file must be located in the android source path.
1818
1919
Optional
2020
-h\t\t\t\t Print help message
@@ -34,4 +34,3 @@ def print_help_msg():
3434

3535
def print_version(pkg_name):
3636
print_package_version(pkg_name, "FOSSLight Android Version:")
37-

src/fosslight_android/_src_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ def run_src_analysis(scan_input_path, start_time="", output_dir=""):
7272
logger.debug(f"Failed to analysis (scan) {scan_input_path}:{result_log}")
7373
except Exception as error:
7474
logger.debug(f"Failed to analysis {scan_input_path}:{error}")
75-
return license
75+
return license

src/fosslight_android/_write_excel.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def create_worksheet(workbook, sheet_name, header_row):
4545
def write_result_to_txt_and_excel(out_excel_file, final_bin_info, out_txt_file):
4646
excel_list = []
4747
final_str = ['Binary Name\tSource Code Path\tNOTICE.html\tOSS Name\tOSS Version\tLicense\tNeed '
48-
'Check\tComment\ttlsh\tchecksum']
48+
'Check\tComment\ttlsh\tchecksum']
4949
if final_bin_info:
5050
for item in sorted(final_bin_info, key=lambda binary: (binary.source_code_path, binary.bin_name)):
5151
try:
@@ -60,5 +60,3 @@ def write_result_to_txt_and_excel(out_excel_file, final_bin_info, out_txt_file):
6060
write_result_to_excel(out_excel_file, excel_list)
6161
else:
6262
logger.warning("Nothing is detected from the scanner so output file is not generated.")
63-
64-

src/fosslight_android/android_binary_analysis.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import os
1010
import re
1111
import json
12-
import getopt
1312
import logging
1413
# Parsing NOTICE
1514
from bs4 import BeautifulSoup
@@ -54,7 +53,6 @@
5453
from fosslight_util.constant import LOGGER_NAME
5554
from fosslight_binary.binary_analysis import return_bin_only
5655
import argparse
57-
import glob
5856
from pathlib import Path
5957

6058
EXCEPTIONAL_PATH = [r"(/)+gen/META/lic_intermediates/"]
@@ -141,15 +139,15 @@ def get_module_json_obj_by_installed_path(module_name, binary_name_with_path, bi
141139

142140
js_value = ""
143141

144-
if module_name in module_info_json_obj: # Binary Name without extension
142+
if module_name in module_info_json_obj: # Binary Name without extension
145143
js_value = module_info_json_obj[module_name]
146144
js_value[MODULE_TYPE_NAME] = module_name
147145
return js_value
148-
elif binary_name_only in module_info_json_obj: # Binary Name
146+
elif binary_name_only in module_info_json_obj: # Binary Name
149147
js_value = module_info_json_obj[binary_name_only]
150148
js_value[MODULE_TYPE_NAME] = binary_name_only
151149
return js_value
152-
else: # Find binary by installed path
150+
else: # Find binary by installed path
153151
for key in module_info_json_obj:
154152
js_value = module_info_json_obj[key]
155153
output_files = js_value["installed"]
@@ -330,7 +328,7 @@ def find_notice_value():
330328
global notice_file_list, final_bin_info
331329

332330
try:
333-
notice_file_list, notice_files= read_notice_file(os.path.abspath(build_out_notice_file_path), NOTICE_HTML_FILE_NAME)
331+
notice_file_list, notice_files = read_notice_file(os.path.abspath(build_out_notice_file_path), NOTICE_HTML_FILE_NAME)
334332
if not notice_file_list:
335333
logger.info(f"Notice file is empty:{notice_files}")
336334
return
@@ -341,7 +339,7 @@ def find_notice_value():
341339
return_list = do_multi_process(find_notice_html, final_bin_info)
342340
final_bin_info = return_list[:]
343341

344-
except IOError as error: # 'CANNOT_FIND_NOTICE_HTML'
342+
except IOError as error: # 'CANNOT_FIND_NOTICE_HTML'
345343
logger.debug(f"find_notice_value:{error}")
346344

347345

@@ -643,7 +641,7 @@ def remove_duplicated_binaries_by_checking_checksum(remove_list_file):
643641
checked_file_name[search_key] = find_result
644642

645643
if find_result:
646-
final_added = "" # finally added binary
644+
final_added = "" # finally added binary
647645
# 0 : file in system folder, 1: Source Path exists, 2:exist in NOTICE.html, 3: shortest path
648646
priority = ["", "", "", ""]
649647
idx_notice = 2
@@ -764,8 +762,6 @@ def main():
764762
_NOTICE_CHECKLIST_TYPE = False
765763
analyze_source = False
766764

767-
argv = sys.argv[1:]
768-
769765
num_cores = multiprocessing.cpu_count() - 1
770766
if num_cores < 1:
771767
num_cores = 1
@@ -786,7 +782,7 @@ def main():
786782
parser.add_argument('-n', '--notice', type=str, required=False)
787783
parser.add_argument('-t', '--toadd', action='store_true', required=False)
788784
parser.add_argument('-m', '--more', action='store_true', required=False)
789-
parser.add_argument('-c', '--check',type=str, required=False)
785+
parser.add_argument('-c', '--check', type=str, required=False)
790786
parser.add_argument('-a', '--android', type=str, required=False)
791787
parser.add_argument('-f', '--find', action='store_true', required=False)
792788
parser.add_argument('-i', '--ignore', action='store_true', required=False)
@@ -799,9 +795,9 @@ def main():
799795
print_help_msg()
800796
if args.version:
801797
print_version(PKG_NAME)
802-
if args.source: # android source path
798+
if args.source: # android source path
803799
os.chdir(args.source)
804-
if args.binary: # Base model's binary.txt to exclude
800+
if args.binary: # Base model's binary.txt to exclude
805801
base_binary_txt = args.binary
806802
if args.notice:
807803
NOTICE_HTML_FILE_NAME = args.notice

src/fosslight_android/check_notice_file.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ def run_notice_html_checklist(binary_file, check_type, notice_file):
4646

4747
def find_bin_in_notice(binary_file_name, notice_file_list):
4848
notice_found = False
49-
notice_matched = ""
5049
if binary_file_name:
5150
if binary_file_name in notice_file_list:
5251
notice_found = True
53-
notice_matched = binary_file_name
5452
else:
5553
apex_name_search_list = []
5654
try:
@@ -59,15 +57,15 @@ def find_bin_in_notice(binary_file_name, notice_file_list):
5957
if m:
6058
apex_name = m.group(1)
6159
if apex_name:
62-
apex_name_search_list = [f"{apex_name}.apex", f"{apex_name}.capex", f"{apex_name}_compressed.apex", f"{apex_name}-uncompressed.apex"]
60+
apex_name_search_list = [f"{apex_name}.apex", f"{apex_name}.capex",
61+
f"{apex_name}_compressed.apex", f"{apex_name}-uncompressed.apex"]
6362
except Exception as error:
64-
pass
63+
logger.debug(f"find_bin_in_notice :{error}")
6564
binary_without_path = os.path.basename(binary_file_name)
6665
for key in notice_file_list:
6766
key_file_name = os.path.basename(key)
6867
if key_file_name == binary_without_path or any(apex_name == key_file_name for apex_name in apex_name_search_list):
6968
notice_found = True
70-
notice_matched = key_file_name
7169
break
7270

7371
return notice_found

0 commit comments

Comments
 (0)