yetone / yetone/auto-rsync

Issue : Inconsistent use of `map` function.

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
25
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The code uses `map` without converting it to a list in the `main` function when reading rsync options from a file:
```python
opts = map(str.strip, opts_file)
rsync_options += u' '.join(opts)
```
In Python 3, `map` returns an iterator, not a list. While this code might coincidentally work because string joining iterates over the map object, it's more explicit and safe to convert the result of `map` to a list before joining. This ensures compatibility and avoids potential issues if the `map` object is consumed elsewhere before the join operation.

The fix would be:
```python
opts = list(map(str.strip, opts_file))
rsync_options += u' '.join(opts)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.