Skip to content

Commit

Permalink
refactor(core,commands): update style, use f-strings
Browse files Browse the repository at this point in the history
Signed-off-by: David Wallace <[email protected]>
  • Loading branch information
MyPyDavid committed Dec 4, 2024
1 parent 091458f commit ffde451
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 4 additions & 7 deletions rdmo/core/management/commands/find_spam_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,16 @@ def find_potential_spam_users(self, timespan, occurrence):
def handle(self, *args, **options):

no_total_users = User.objects.all().count()
print('Total no of users: %d' % (no_total_users))
print(f'Total no of users: {no_total_users}')
potential_spam_users, no_users_having_projects =\
self.find_potential_spam_users(
options['timespan'], options['occurrence']
)

print(
'Potential spam users: %d %.2f%% / of which have at least one project %d'
% (
len(potential_spam_users),
(100/no_total_users)*len(potential_spam_users),
no_users_having_projects
)
f'Potential spam users: {len(potential_spam_users)} '
f'{(100 / no_total_users) * len(potential_spam_users):.2f}% '
f'/ of which have at least one project {no_users_having_projects}'
)

self.save_csv(potential_spam_users, options['output_file'])
Expand Down
9 changes: 3 additions & 6 deletions rdmo/core/management/commands/find_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,12 @@ def find_users(self, options):

def handle(self, *args, **options):
no_total_users = User.objects.all().count()
print('Total no of users: %d' % (no_total_users))
print(f'Total no of users: {no_total_users}')
found_users = self.find_users(options)

print(
'Matching the filter: %d %.2f%%'
% (
len(found_users),
(100/no_total_users)*len(found_users)
)
f'Matching the filter: {len(found_users)} '
f'{(100 / no_total_users) * len(found_users):.2f}% '
)

self.save_csv(found_users, options['output_file'])
Expand Down

0 comments on commit ffde451

Please sign in to comment.