Skip to content

Commit 683fd02

Browse files
committed
iCloud3 v3, Release Candidate 1
1 parent 079b5ef commit 683fd02

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

Diff for: custom_components/icloud3/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
130130
config_file.load_storage_icloud3_configuration_file()
131131
start_ic3.set_log_level(Gb.log_level)
132132
open_ic3_log_file(new_log_file=Gb.log_debug_flag)
133+
# config_file.count_lines_of_code(Gb.icloud3_directory)
133134

134135
Gb.evlog_btnconfig_url = Gb.conf_profile[CONF_EVLOG_BTNCONFIG_URL].strip()
135136
Gb.evlog_version = Gb.conf_profile['event_log_version']

Diff for: custom_components/icloud3/services.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# yamllint disable rule:document-start
2+
# yamllint disable rule:line-length
3+
4+
icloud3_action:
5+
description: This service allows you to change the way iCloud3 operates.
6+
fields:
7+
device_name:
8+
description: Name of the device to be updated. All devices will be updated if this parameter is not specified. (Optional)
9+
example: gary_iphone
10+
command:
11+
description: The action to be performed. (Required)
12+
example: log_level debug
13+
14+
icloud3_update:
15+
description: This service allows you to change the way iCloud3 operates.
16+
fields:
17+
device_name:
18+
description: Name of the device to be updated. All devices will be updated if this parameter is not specified. (Optional)
19+
example: gary_iphone
20+
command:
21+
description: The action to be performed. (Required)
22+
example: log_level debug
23+
24+
icloud3_restart:
25+
description: This service will refresh all of the devices being handled by iCloud3 and can be used when you have added a new device to your Apple account. You will have to restart Home Assist if you have made changes to the platform parameters (new device type, new device name, etc.)
26+
fields:
27+
account_name:
28+
description: account_name of the iCloud3 custom component specified in the Configuration Variables section described at the beginning of this document. (Required)
29+
example: gary_icloud
30+
31+
icloud3_lost_iphone:
32+
description: This service will play the Lost iPhone sound on a specific device.
33+
fields:
34+
device_name:
35+
description: Name of the device to be located (required).
36+
example: gary_icloud
37+
38+
icloud3_find_phone_alert:
39+
description: This service will send a find phone message to the specific device.
40+
fields:
41+
device_name:
42+
description: Name of the device to be located (required).
43+
example: gary_icloud

Diff for: custom_components/icloud3/support/config_file.py

+44-1
Original file line numberDiff line numberDiff line change
@@ -551,4 +551,47 @@ def build_initial_config_file_structure():
551551
pass
552552

553553

554-
#--------------------------------------------------------------------:)
554+
#--------------------------------------------------------------------
555+
def count_lines_of_code(start_directory, total_file_lines=0, total_code_lines=0, begin_start=None):
556+
557+
if begin_start is None:
558+
log_info_msg(f"Lines Of Code Count - {start_directory}")
559+
log_info_msg(" ")
560+
log_info_msg("---All Lines--- ---Code Lines--- Module")
561+
log_info_msg("Total Lines Total Lines")
562+
# ("11111111 22222222 33333333 44444444
563+
564+
for file_name in os.listdir(start_directory):
565+
file_name = os.path.join(start_directory, file_name)
566+
if os.path.isfile(file_name):
567+
if file_name.endswith('.py') or file_name.endswith('.js'):
568+
with open(file_name, 'r') as f:
569+
lines = f.readlines()
570+
line_cnt = len(lines)
571+
total_file_lines += line_cnt
572+
code_cnt = 0
573+
for line in lines:
574+
if line is not None and len(line.strip()) > 3:
575+
if (line.startswith("'")
576+
or line.startswith('#')):
577+
continue
578+
579+
code_cnt += 1
580+
581+
total_code_lines += code_cnt
582+
583+
if begin_start is not None:
584+
reldir_of_file_name = '.' + file_name.replace(begin_start, '')
585+
else:
586+
reldir_of_file_name = '.' + file_name.replace(start_directory, '')
587+
588+
log_info_msg( f"{total_file_lines:<9} {line_cnt:<9} {total_code_lines:<9} "
589+
f"{code_cnt:<8} {reldir_of_file_name}")
590+
591+
for file_name in os.listdir(start_directory):
592+
file_name = os.path.join(start_directory, file_name)
593+
if os.path.isdir(file_name):
594+
total_file_lines, total_code_lines = \
595+
count_lines_of_code(file_name, total_file_lines, total_code_lines, begin_start=start_directory)
596+
597+
return total_file_lines, total_code_lines

0 commit comments

Comments
 (0)