Skip to content

Commit cc98728

Browse files
committed
Addressed @ASalvail's comments
1 parent dd3458f commit cc98728

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

smartdispatch/argument_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def unfold(self, match):
3535
start = int(groups[0])
3636
end = int(groups[1])
3737
step = 1 if groups[2] is None else int(groups[2])
38-
return list(map(str, range(start, end, step)))
38+
return [str(i) for i in range(start, end, step)]
3939

4040

4141
argument_templates = build_argument_templates_dictionnary()

smartdispatch/smartdispatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def unfold_command(command):
9696
pos = match.end()
9797

9898
arguments.append([text[pos:]]) # Add remaining unfolded arguments
99-
arguments = [list(map(utils.decode_escaped_characters, argvalues)) for argvalues in arguments]
99+
arguments = [[utils.decode_escaped_characters(v) for v in argvalues] for argvalues in arguments]
100100
return ["".join(argvalues) for argvalues in itertools.product(*arguments)]
101101

102102

smartdispatch/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ def slugify(value):
6060
---------
6161
https://github.com/django/django/blob/1.7c3/django/utils/text.py#L436
6262
"""
63+
# Convert `value` to Unicode so we can slugify it using the unicodedata module.
6364
try:
6465
value = unicode(value, "UTF-8")
6566
except NameError:
66-
pass # In Python 3 all strings are already unicode.
67+
pass # In Python 3, all strings are already stored as Unicode.
6768

69+
# Replace all compatibility characters with their equivalents.
6870
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
6971
value = re.sub('[^\w\s-]', '', value).strip().lower()
7072
return str(re.sub('[-\s]+', '_', value))

tests/test_smart_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setUp(self):
2222
self.command_manager = CommandManager(os.path.join(self._commands_dir, "commands.txt"))
2323
self.command_manager.set_commands_to_run(self.commands)
2424

25-
self.commands_uid = list(map(utils.generate_uid_from_string, self.commands))
25+
self.commands_uid = [utils.generate_uid_from_string(c) for c in self.commands]
2626

2727
def tearDown(self):
2828
shutil.rmtree(self._commands_dir)

0 commit comments

Comments
 (0)