Skip to content

Commit 6812ea1

Browse files
committed
Addressed @ASalvail's comments
1 parent 70d679b commit 6812ea1

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
@@ -97,7 +97,7 @@ def unfold_command(command):
9797
pos = match.end()
9898

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

103103

smartdispatch/utils.py

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

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

smartdispatch/workers/tests/test_base_worker.py

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

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

3030
def tearDown(self):
3131
shutil.rmtree(self._commands_dir)

0 commit comments

Comments
 (0)