zero323 commented on a change in pull request #34411:
URL: https://github.com/apache/spark/pull/34411#discussion_r741866367
##########
File path: python/pyspark/conf.py
##########
@@ -178,49 +193,49 @@ def setAll(self, pairs):
self.set(k, v)
return self
- def get(self, key, defaultValue=None):
+ def get(self, key: str, defaultValue: Optional[str] = None) ->
Optional[str]:
"""Get the configured value for some key, or return a default
otherwise."""
- if defaultValue is None: # Py4J doesn't call the right get() if we
pass None
+ if defaultValue is None: # Py4J doesn't call the right get() if we
pass None
if self._jconf is not None:
if not self._jconf.contains(key):
return None
return self._jconf.get(key)
else:
- if key not in self._conf:
+ if key not in cast(Dict[str, str], self._conf):
return None
- return self._conf[key]
+ return cast(Dict[str, str], self._conf)[key]
Review comment:
Also, same as above ‒ single `assert` might be a better option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]