@@ -461,29 +461,27 @@ def transaction_to_record_infos(self, ioc_info: IocInfo, transaction: CommitTran
461461 )
462462 return record_infos
463463
464- def record_info_by_name (
465- self , recordInfosByRecordID : Dict [str , RecordInfo ], ioc_info : IocInfo
466- ) -> Dict [str , RecordInfo ]:
464+ def record_info_by_name (self , record_infos : Dict [str , RecordInfo ], ioc_info : IocInfo ) -> Dict [str , RecordInfo ]:
467465 """Create a dictionary of RecordInfo objects keyed by pvName.
468466
469467 Args:
470- recordInfosByRecordID : Dictionary of RecordInfo objects keyed by record_id.
468+ record_infos : Dictionary of RecordInfo objects keyed by record_id.
471469 ioc_info: Information from the IOC.
472470 """
473- recordInfoByName = {}
474- for record_id , (info ) in recordInfosByRecordID .items ():
475- if info .pv_name in recordInfoByName :
471+ record_info_by_name = {}
472+ for record_id , (info ) in record_infos .items ():
473+ if info .pv_name in record_info_by_name :
476474 _log .warning ("Commit contains multiple records with PV name: %s (%s)" , info .pv_name , ioc_info )
477475 continue
478- recordInfoByName [info .pv_name ] = info
479- return recordInfoByName
476+ record_info_by_name [info .pv_name ] = info
477+ return record_info_by_name
480478
481479 def update_ioc_infos (
482480 self ,
483481 transaction : CommitTransaction ,
484482 ioc_info : IocInfo ,
485483 records_to_delete : List [str ],
486- recordInfoByName : Dict [str , RecordInfo ],
484+ record_info_by_name : Dict [str , RecordInfo ],
487485 ) -> None :
488486 """Update the internal IOC information based on the transaction.
489487
@@ -493,30 +491,30 @@ def update_ioc_infos(
493491 transaction: The CommitTransaction being processed.
494492 ioc_info: The IocInfo for the IOC in the transaction.
495493 records_to_delete: List of record names to delete.
496- recordInfoByName : Dictionary of RecordInfo objects keyed by pvName.
494+ record_info_by_name : Dictionary of RecordInfo objects keyed by pvName.
497495 """
498496 iocid = ioc_info .ioc_id
499497 if transaction .initial :
500498 # Add IOC to source list
501499 self .iocs [iocid ] = ioc_info
502500 if not transaction .connected :
503501 records_to_delete .extend (self .channel_ioc_ids .keys ())
504- for record_name in recordInfoByName .keys ():
502+ for record_name in record_info_by_name .keys ():
505503 self .channel_ioc_ids [record_name ].append (iocid )
506504 self .iocs [iocid ].channelcount += 1
507505 # In case, alias exists
508506 if self .cf_config .alias_enabled :
509- if record_name in recordInfoByName :
510- for record_aliases in recordInfoByName [record_name ].aliases :
507+ if record_name in record_info_by_name :
508+ for record_aliases in record_info_by_name [record_name ].aliases :
511509 self .channel_ioc_ids [record_aliases ].append (iocid ) # add iocname to pvName in dict
512510 self .iocs [iocid ].channelcount += 1
513511 for record_name in records_to_delete :
514512 if iocid in self .channel_ioc_ids [record_name ]:
515513 self .remove_channel (record_name , iocid )
516514 # In case, alias exists
517515 if self .cf_config .alias_enabled :
518- if record_name in recordInfoByName :
519- for record_aliases in recordInfoByName [record_name ].aliases :
516+ if record_name in record_info_by_name :
517+ for record_aliases in record_info_by_name [record_name ].aliases :
520518 self .remove_channel (record_aliases , iocid )
521519
522520 def _commitWithThread (self , transaction : CommitTransaction ):
@@ -555,14 +553,14 @@ def _commitWithThread(self, transaction: CommitTransaction):
555553 channelcount = 0 ,
556554 )
557555
558- recordInfoById = self .transaction_to_record_infos (ioc_info , transaction )
556+ record_infos = self .transaction_to_record_infos (ioc_info , transaction )
559557
560558 records_to_delete = list (transaction .records_to_delete )
561559 _log .debug ("Delete records: %s" , records_to_delete )
562560
563- recordInfoByName = self .record_info_by_name (recordInfoById , ioc_info )
564- self .update_ioc_infos (transaction , ioc_info , records_to_delete , recordInfoByName )
565- poll (__updateCF__ , self , recordInfoByName , records_to_delete , ioc_info )
561+ record_info_by_name = self .record_info_by_name (record_infos , ioc_info )
562+ self .update_ioc_infos (transaction , ioc_info , records_to_delete , record_info_by_name )
563+ poll (__updateCF__ , self , record_info_by_name , records_to_delete , ioc_info )
566564
567565 def remove_channel (self , recordName : str , iocid : str ) -> None :
568566 """Remove channel from self.iocs and self.channel_ioc_ids.
@@ -656,7 +654,7 @@ def handle_channel_is_old(
656654 processor : CFProcessor ,
657655 cf_config : CFConfig ,
658656 channels : List [CFChannel ],
659- recordInfoByName : Dict [str , RecordInfo ],
657+ record_info_by_name : Dict [str , RecordInfo ],
660658) -> None :
661659 """Handle the case when the channel exists in channelfinder but not in the recceiver.
662660
@@ -672,7 +670,7 @@ def handle_channel_is_old(
672670 processor: Processor going through transaction
673671 cf_config: Configuration used for processor
674672 channels: list of the current channel changes
675- recordInfoByName : Input information from the transaction
673+ record_info_by_name : Input information from the transaction
676674 """
677675 last_ioc_id = channel_ioc_ids [cf_channel .name ][- 1 ]
678676 cf_channel .owner = iocs [last_ioc_id ].owner
@@ -685,8 +683,8 @@ def handle_channel_is_old(
685683 _log .debug ("Add existing channel %s to previous IOC %s" , cf_channel , last_ioc_id )
686684 # In case alias exist, also delete them
687685 if cf_config .alias_enabled :
688- if cf_channel .name in recordInfoByName :
689- for alias_name in recordInfoByName [cf_channel .name ].aliases :
686+ if cf_channel .name in record_info_by_name :
687+ for alias_name in record_info_by_name [cf_channel .name ].aliases :
690688 # TODO Remove? This code couldn't have been working....
691689 alias_channel = CFChannel (alias_name , "" , [])
692690 if alias_name in channel_ioc_ids :
@@ -712,7 +710,7 @@ def orphan_channel(
712710 ioc_info : IocInfo ,
713711 channels : List [CFChannel ],
714712 cf_config : CFConfig ,
715- recordInfoByName : Dict [str , RecordInfo ],
713+ record_info_by_name : Dict [str , RecordInfo ],
716714) -> None :
717715 """Handle a channel that exists in channelfinder but not on this recceiver.
718716
@@ -724,7 +722,7 @@ def orphan_channel(
724722 ioc_info: Info of the current ioc
725723 channels: The current list of channel changes
726724 cf_config: Configuration of the proccessor
727- recordInfoByName : information from the transaction
725+ record_info_by_name : information from the transaction
728726 """
729727 cf_channel .properties = __merge_property_lists (
730728 [
@@ -737,8 +735,8 @@ def orphan_channel(
737735 _log .debug ("Add orphaned channel %s with no IOC: %s" , cf_channel , ioc_info )
738736 # Also orphan any alias
739737 if cf_config .alias_enabled :
740- if cf_channel .name in recordInfoByName :
741- for alias_name in recordInfoByName [cf_channel .name ].aliases :
738+ if cf_channel .name in record_info_by_name :
739+ for alias_name in record_info_by_name [cf_channel .name ].aliases :
742740 alias_channel = CFChannel (alias_name , "" , [])
743741 alias_channel .properties = __merge_property_lists (
744742 [
@@ -759,7 +757,7 @@ def handle_channel_old_and_new(
759757 channels : List [CFChannel ],
760758 new_channels : Set [str ],
761759 cf_config : CFConfig ,
762- recordInfoByName : Dict [str , RecordInfo ],
760+ record_info_by_name : Dict [str , RecordInfo ],
763761 old_channels : List [CFChannel ],
764762) -> None :
765763 """
@@ -778,7 +776,7 @@ def handle_channel_old_and_new(
778776 channels: The current list of channel changes
779777 new_channels: The list of new channels
780778 cf_config: Configuration of the processor
781- recordInfoByName : information from the transaction
779+ record_info_by_name : information from the transaction
782780 old_channels: The list of old channels
783781 """
784782 _log .debug ("Channel %s exists in Channelfinder with same iocid %s" , cf_channel .name , iocid )
@@ -796,8 +794,8 @@ def handle_channel_old_and_new(
796794
797795 # In case, alias exist
798796 if cf_config .alias_enabled :
799- if cf_channel .name in recordInfoByName :
800- for alias_name in recordInfoByName [cf_channel .name ].aliases :
797+ if cf_channel .name in record_info_by_name :
798+ for alias_name in record_info_by_name [cf_channel .name ].aliases :
801799 if alias_name in old_channels :
802800 # alias exists in old list
803801 alias_channel = CFChannel (alias_name , "" , [])
@@ -883,7 +881,7 @@ def handle_old_channels(
883881 processor : CFProcessor ,
884882 cf_config : CFConfig ,
885883 channels : List [CFChannel ],
886- recordInfoByName : Dict [str , RecordInfo ],
884+ record_info_by_name : Dict [str , RecordInfo ],
887885 iocid : str ,
888886) -> None :
889887 """Handle channels already present in Channelfinder for this IOC.
@@ -911,7 +909,7 @@ def handle_old_channels(
911909 channels: The list of channels.
912910 alias_enabled: Whether aliases are enabled.
913911 record_type_enabled: Whether record types are enabled.
914- recordInfoByName : The dictionary of record names to information.
912+ record_info_by_name : The dictionary of record names to information.
915913 iocid: The IOC ID.
916914 cf_config: The configuration for the processor.
917915 processor: The processor.
@@ -931,10 +929,10 @@ def handle_old_channels(
931929 processor ,
932930 cf_config ,
933931 channels ,
934- recordInfoByName ,
932+ record_info_by_name ,
935933 )
936934 else :
937- orphan_channel (cf_channel , ioc_info , channels , cf_config , recordInfoByName )
935+ orphan_channel (cf_channel , ioc_info , channels , cf_config , record_info_by_name )
938936 else :
939937 if cf_channel .name in new_channels : # case: channel in old and new
940938 handle_channel_old_and_new (
@@ -945,7 +943,7 @@ def handle_old_channels(
945943 channels ,
946944 new_channels ,
947945 cf_config ,
948- recordInfoByName ,
946+ record_info_by_name ,
949947 old_channels ,
950948 )
951949
@@ -957,7 +955,7 @@ def update_existing_channel_diff_iocid(
957955 processor : CFProcessor ,
958956 channels : List [CFChannel ],
959957 cf_config : CFConfig ,
960- recordInfoByName : Dict [str , RecordInfo ],
958+ record_info_by_name : Dict [str , RecordInfo ],
961959 ioc_info : IocInfo ,
962960 iocid : str ,
963961) -> None :
@@ -973,7 +971,7 @@ def update_existing_channel_diff_iocid(
973971 processor: The processor.
974972 channels: The list of channels.
975973 cf_config: configuration of processor
976- recordInfoByName : The dictionary of record names to information.
974+ record_info_by_name : The dictionary of record names to information.
977975 ioc_info: The IOC information.
978976 iocid: The IOC ID.
979977 """
@@ -987,11 +985,11 @@ def update_existing_channel_diff_iocid(
987985 _log .debug ("Add existing channel with different IOC: %s" , existingChannel )
988986 # in case, alias exists, update their properties too
989987 if cf_config .alias_enabled :
990- if channel_name in recordInfoByName :
988+ if channel_name in record_info_by_name :
991989 alProps = [CFProperty .alias (ioc_info .owner , channel_name )]
992990 for p in newProps :
993991 alProps .append (p )
994- for alias_name in recordInfoByName [channel_name ].aliases :
992+ for alias_name in record_info_by_name [channel_name ].aliases :
995993 if alias_name in existingChannels :
996994 ach = existingChannels [alias_name ]
997995 ach .properties = __merge_property_lists (
@@ -1011,7 +1009,7 @@ def create_new_channel(
10111009 ioc_info : IocInfo ,
10121010 newProps : List [CFProperty ],
10131011 cf_config : CFConfig ,
1014- recordInfoByName : Dict [str , RecordInfo ],
1012+ record_info_by_name : Dict [str , RecordInfo ],
10151013) -> None :
10161014 """Create a new channel.
10171015
@@ -1024,43 +1022,43 @@ def create_new_channel(
10241022 ioc_info: The IOC information.
10251023 newProps: The new properties.
10261024 cf_config: configuration of processor
1027- recordInfoByName : The dictionary of record names to information.
1025+ record_info_by_name : The dictionary of record names to information.
10281026 """
10291027
10301028 channels .append (CFChannel (channel_name , ioc_info .owner , newProps ))
10311029 _log .debug ("Add new channel: %s" , channel_name )
10321030 if cf_config .alias_enabled :
1033- if channel_name in recordInfoByName :
1031+ if channel_name in record_info_by_name :
10341032 alProps = [CFProperty .alias (ioc_info .owner , channel_name )]
10351033 for p in newProps :
10361034 alProps .append (p )
1037- for alias in recordInfoByName [channel_name ].aliases :
1035+ for alias in record_info_by_name [channel_name ].aliases :
10381036 channels .append (CFChannel (alias , ioc_info .owner , alProps ))
10391037 _log .debug ("Add new alias: %s from %s" , alias , channel_name )
10401038
10411039
10421040def __updateCF__ (
1043- processor : CFProcessor , recordInfoByName : Dict [str , RecordInfo ], records_to_delete , ioc_info : IocInfo
1041+ processor : CFProcessor , record_info_by_name : Dict [str , RecordInfo ], records_to_delete , ioc_info : IocInfo
10441042) -> None :
10451043 """Update Channelfinder with the provided IOC and Record information.
10461044
10471045 Calculates the changes required to the channels list and pushes the update the channelfinder.
10481046
10491047 Args:
10501048 processor: The processor.
1051- recordInfoByName : The dictionary of record names to information.
1049+ record_info_by_name : The dictionary of record names to information.
10521050 records_to_delete: The list of records to delete.
10531051 ioc_info: The IOC information.
10541052 """
10551053 _log .info ("CF Update IOC: %s" , ioc_info )
1056- _log .debug ("CF Update IOC: %s recordInfoByName %s" , ioc_info , recordInfoByName )
1054+ _log .debug ("CF Update IOC: %s record_info_by_name %s" , ioc_info , record_info_by_name )
10571055 # Consider making this function a class methed then 'processor' simply becomes 'self'
10581056 client = processor .client
10591057 channel_ioc_ids = processor .channel_ioc_ids
10601058 iocs = processor .iocs
10611059 cf_config = processor .cf_config
10621060 recceiverid = processor .cf_config .recceiver_id
1063- new_channels = set (recordInfoByName .keys ())
1061+ new_channels = set (record_info_by_name .keys ())
10641062 iocid = ioc_info .ioc_id
10651063
10661064 if iocid not in iocs :
@@ -1092,7 +1090,7 @@ def __updateCF__(
10921090 processor ,
10931091 cf_config ,
10941092 channels ,
1095- recordInfoByName ,
1093+ record_info_by_name ,
10961094 iocid ,
10971095 )
10981096 # now pvNames contains a list of pv's new on this host/ioc
@@ -1110,12 +1108,12 @@ def __updateCF__(
11101108 )
11111109 if (
11121110 cf_config .record_type_enabled
1113- and channel_name in recordInfoByName
1114- and recordInfoByName [channel_name ].record_type
1111+ and channel_name in record_info_by_name
1112+ and record_info_by_name [channel_name ].record_type
11151113 ):
1116- newProps .append (CFProperty .record_type (ioc_info .owner , recordInfoByName [channel_name ].record_type ))
1117- if channel_name in recordInfoByName :
1118- newProps = newProps + recordInfoByName [channel_name ].info_properties
1114+ newProps .append (CFProperty .record_type (ioc_info .owner , record_info_by_name [channel_name ].record_type ))
1115+ if channel_name in record_info_by_name :
1116+ newProps = newProps + record_info_by_name [channel_name ].info_properties
11191117
11201118 if channel_name in existingChannels :
11211119 _log .debug ("update existing channel %s: exists but with a different iocid from %s" , channel_name , iocid )
@@ -1126,12 +1124,12 @@ def __updateCF__(
11261124 processor ,
11271125 channels ,
11281126 cf_config ,
1129- recordInfoByName ,
1127+ record_info_by_name ,
11301128 ioc_info ,
11311129 iocid ,
11321130 )
11331131 else :
1134- create_new_channel (channels , channel_name , ioc_info , newProps , cf_config , recordInfoByName )
1132+ create_new_channel (channels , channel_name , ioc_info , newProps , cf_config , record_info_by_name )
11351133 _log .info ("Total channels to update: %s for ioc: %s" , len (channels ), ioc_info )
11361134
11371135 if len (channels ) != 0 :
@@ -1255,7 +1253,7 @@ def prepareFindArgs(cf_config: CFConfig, args, size=0) -> List[Tuple[str, str]]:
12551253def poll (
12561254 update_method : Callable [[CFProcessor , Dict [str , RecordInfo ], List [str ], IocInfo ], None ],
12571255 processor : CFProcessor ,
1258- recordInfoByName : Dict [str , RecordInfo ],
1256+ record_info_by_name : Dict [str , RecordInfo ],
12591257 records_to_delete ,
12601258 ioc_info : IocInfo ,
12611259) -> bool :
@@ -1264,7 +1262,7 @@ def poll(
12641262 Args:
12651263 update_method: The update method.
12661264 processor: The processor.
1267- recordInfoByName : The record information by name.
1265+ record_info_by_name : The record information by name.
12681266 records_to_delete: The records to delete.
12691267 ioc_info: The IOC information.
12701268 """
@@ -1273,7 +1271,7 @@ def poll(
12731271 success = False
12741272 while not success :
12751273 try :
1276- update_method (processor , recordInfoByName , records_to_delete , ioc_info )
1274+ update_method (processor , record_info_by_name , records_to_delete , ioc_info )
12771275 success = True
12781276 return success
12791277 except RequestException as e :
0 commit comments