Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Correct URL handling for Elasticsearch/OpenSearch #3577
Correct URL handling for Elasticsearch/OpenSearch #3577
Changes from all commits
fcd727f
062d40d
2f3671d
d8de2b4
1a23098
47640d9
4c5e38b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What's the point of adding an unused
kwargs
??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.
It resolved a lint error, probably for
ConversionError.__init__()
(I don't remember which function specifically -- there are several with similar issues).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.
Ugh; this is ugly. OK, so
ConversionError
is designed with**kwargs
to allow callers to pass anhttp_status
through theConversionError
constructor toSchemaError
... but if anyone used otherkwargs
it wouldn't work, and the explicit declaration here is misleading becauseSchemaError
really doesn't support kwargs. (Pass-through or otherwise.)I'm curious where you're seeing a lint warning, because I'm not. 😦
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.
FYI, the
http_status
is only specified throughConversionError
inconvert_username
andtest_exceptions.py
... I don't see any lint annotations. I'm curious exactly what you're seeing, and this workaround bugs me because it shouldn't be necessary.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.
Looking at the
main
branch, I'm gettingUnexpected argument
on thesuper().__init__()
invocation inDatasetConversionError.__init__()
, but, interestingly, I don't get the complaint for the one inConversionError.__init__()
. 🤷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.
I presume it's because the linter knows that (in the code in the
main
branch),Schema.__init__()
accepts only one argument which, in the case ofConversionError.__init__()
, could be in**kwargs
, whereas in the case ofDatasetConversionError.__init__()
it can't/shouldn't be, since thehttp_status
argument has already been specified explicitly, there.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.
Sure, I guess, because
DatasetConversionError
passeshttp_status
explicitly and doesn't actually usekwargs
. (In fact, it can't, aside from repeating thehttp_status
, because it's not good for anything else.)I think your linter is broken. But if you really want to quiet its ranting, a better "ugly workaround" would be to add an explicit
http_status: Optional[int] = None
toConversionError
, pass it on, and drop thekwargs
entirely from bothConversionError
andDatasetConversionError
(which, so far as I can see, is never used anyway... maybe it was at one time).But again, I don't think there's anything illegal or even unreasonable here, and I think this is just an argument against your linter. 😆
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.
I can't really argue against my linter -- it is more or less built-in to my IDE; and arguing with a linter is, as we know, largely pointless. 🙃
At this point, I'm not inclined to disturb the
SchemaError
(and children) code any further. Given that the Production deployment seems happy, shall I go ahead and merge this?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.
I really dislike adding
kwargs
here, because it makes no sense and is potentially misleading. But, whatever: it'll never be perfect.