Skip to content

Commit

Permalink
Merge pull request #7 from CN-UPB/deepsource-fix-98ff26d9
Browse files Browse the repository at this point in the history
Iterate dictionary directly
  • Loading branch information
Stefan Schneider authored Mar 16, 2021
2 parents 4659302 + dd1e8ed commit 5155807
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deepcomp/env/entities/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def plot(self, ax, radius=2, details=False):

def update_curr_dr(self):
"""Update the current data rate of all BS connections according to the current situation (pos & assignment)"""
for bs in self.bs_dr.keys():
for bs in self.bs_dr:
self.bs_dr[bs] = bs.data_rate(self)

def update_ewma_dr(self, weight=0.9):
Expand Down Expand Up @@ -162,7 +162,7 @@ def check_bs_connection(self):
:return: Number of removed/lost connections
"""
remove_bs = []
for bs in self.bs_dr.keys():
for bs in self.bs_dr:
if not bs.can_connect(self.pos):
self.log.info("Losing connection to BS", bs=bs)
remove_bs.append(bs)
Expand Down Expand Up @@ -215,7 +215,7 @@ def disconnect_from_bs(self, bs):
def ues_at_same_bs(self):
"""Return set of UEs that are currently connected to any of the BS that this UE is connected to"""
ue_set = set()
for bs in self.bs_dr.keys():
for bs in self.bs_dr:
ue_set.update(set(bs.conn_ues))
self.log.debug('UEs at same BS', ue_set=ue_set)
return ue_set

0 comments on commit 5155807

Please sign in to comment.