Created
December 12, 2017 01:44
-
-
Save clarksun/c226adebbd8e07c47c3f118947a87c0e to your computer and use it in GitHub Desktop.
关键字参数使用 #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# kafka/consumer/group.py | |
class KafkaConsumer(six.Iterator): | |
DEFAULT_CONFIG = { | |
'bootstrap_servers': 'localhost', | |
'xxx':'yyy', | |
} | |
def __init__(self, *topics, **configs): | |
self.config = copy.copy(self.DEFAULT_CONFIG) | |
for key in self.config: | |
if key in configs: | |
self.config[key] = configs.pop(key) | |
# Only check for extra config keys in top-level class | |
assert not configs, 'Unrecognized configs: %s' % configs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment