[FIX] Detect duplicate names of variables in projections.#4550
[FIX] Detect duplicate names of variables in projections.#4550VesnaT merged 1 commit intobiolab:masterfrom
Conversation
|
|
VesnaT
left a comment
There was a problem hiding this comment.
Also, adding a test would be nice.
Orange/projection/base.py
Outdated
| postfixes = ["x", "y"] if n == 2 else [str(i) for i in range(1, n + 1)] | ||
| names = [f"{self.var_prefix}-{postfix}" for postfix in postfixes] | ||
| return get_unique_names(self.orig_domain, names) | ||
| return names |
There was a problem hiding this comment.
Since DomainProjection can be used independently of any widget, I'd leave it as it was (retain the get_unique_names)
| self.projection.domain.attributes]) | ||
|
|
||
| attributes = tuple([a.copy(name=n) for n, a in | ||
| zip(names, self.projection.domain.attributes)]) |
There was a problem hiding this comment.
Lint is complaining about the indentation. Speaking of lint, please keep the line length up to 79 characters.
| if self.data is None or self.projection is None: | ||
| return None | ||
|
|
||
| names = get_unique_names(self.data.domain, [a.name for a in |
There was a problem hiding this comment.
Maybe the variables should be copied only when necessary, i.e. when the obtained names are different than the proposed.
Codecov Report
@@ Coverage Diff @@
## master #4550 +/- ##
==========================================
- Coverage 83.55% 83.54% -0.02%
==========================================
Files 281 276 -5
Lines 56126 55326 -800
==========================================
- Hits 46895 46221 -674
+ Misses 9231 9105 -126 |
ad35968 to
7eb23af
Compare
Apply the requested changes. Fix pylint error Add code Fix projection data domain duplicate checking. Add test for unique name after linearprojection components added. Refactor code.
7eb23af to
6a91784
Compare
Issue
Fixes #4497
Description of changes
Check for duplicates in original domain, not only in the selected one.
Includes