-
Notifications
You must be signed in to change notification settings - Fork 1.5k
BUG: fix for merge page with annotation #3467 #3532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
stefan6419846
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look at the test failures and add appropriate tests.
Additionally, while your current approach might work for the current cases, I see some limitations/aspects to discuss:
- What happens to keyword-only arguments?
- What happens to unmatched keys?
- What happens to keys which have to renamed for some reasons, for example because they conflict with an existing name (like a builtin)?
Please provide some details on how you think about this and what your proposals for mitigating them are.
| super().__init__(**kwargs) | ||
| if len(vertices) == 0: | ||
| raise ValueError("A polygon needs at least 1 vertex with two coordinates") | ||
| if len(vertices) == 0 or len(vertices) % 2 != 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this new check relate to your changes and why does the error message need a rewording?
| for x, y in vertices: | ||
| coord_list.append(NumberObject(x)) | ||
| coord_list.append(NumberObject(y)) | ||
| if type(vertices) is ArrayObject: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not isinstance(vertices, ArrayObject)?
| if type(vertices) is ArrayObject: | ||
| import itertools | ||
| coord_list = vertices | ||
| vertices = [vertex for vertex in itertools.batched(vertices, 2)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
itertools.batched requires Python >= 3.12, while we have to support Python >= 3.9.
| super().__init__(**kwargs) | ||
| if len(vertices) == 0: | ||
| raise ValueError("A polygon needs at least 1 vertex with two coordinates") | ||
| if len(vertices) == 0 or len(vertices) % 2 != 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid unnecessary repetition by extracting common functionality.
see #3467
there are a couple different solutions. this is the one i made.
for my solution, i have to assume that the key name inside
DictionaryObject==__init__parameter names. for example/Verticesandvertices. with these changes the example in #3467 exits normally.i had to modify the
__init__logic forPolygonandPolyLine, as they both expectedtuples which is not the format they are stored inDictionaryObjectif we agree this is acceptable solution, i will also add test case adapted from the issue.