Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else: # if tables is a list
files = tables
agents = []
for idx, file in enumerate(files):
if type(num_pops) == int:
agents_num = num_pops # int(pd.read_csv(os.path.join(stats, file)).users_count.iloc[0])
else:
agents_num = num_pops[idx]
if type(tables) == str:
clus_dyn = pd.read_csv(os.path.join(dyn_mat, file), index_col=[0])
for i in range(agents_num):
agents.append(Agent(clus_dyn, file.split('_')[1].split('.')[0], self.restriction_pos, config))
else:
step_matr = self.prepare_step_matrix(file)
for i in range(agents_num):
agents.append(Agent(step_matr, idx, self.restriction_pos, config))
return agents
if type(tables) == str: # through folders
dyn_mat = os.path.join(path, tables)
files = sorted(
list(filter(lambda x: x[0] != '.', os.listdir(dyn_mat)))) # collect all files except MacOS system files
else: # if tables is a list
files = tables
agents = []
for idx, file in enumerate(files):
if type(num_pops) == int:
agents_num = num_pops # int(pd.read_csv(os.path.join(stats, file)).users_count.iloc[0])
else:
agents_num = num_pops[idx]
if type(tables) == str:
clus_dyn = pd.read_csv(os.path.join(dyn_mat, file), index_col=[0])
for i in range(agents_num):
agents.append(Agent(clus_dyn, file.split('_')[1].split('.')[0], self.restriction_pos, config))
else:
step_matr = self.prepare_step_matrix(file)
for i in range(agents_num):
agents.append(Agent(step_matr, idx, self.restriction_pos, config))
return agents