You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/11/08 06:13:06 UTC

[GitHub] [rocketmq-client-python] duhenglucky commented on a change in pull request #72: style(client) polish code style

duhenglucky commented on a change in pull request #72: style(client) polish code style
URL: https://github.com/apache/rocketmq-client-python/pull/72#discussion_r344000636
 
 

 ##########
 File path: rocketmq/client.py
 ##########
 @@ -208,41 +202,38 @@ def __init__(self, group_id, orderly=False, timeout=None, compress_level=None, m
     def __enter__(self):
         self.start()
 
-    def __exit__(self, type, value, traceback):
+    def __exit__(self, exec_type, value, traceback):
         self.shutdown()
 
-    def destroy(self):
-        if self._handle is not None:
-            ffi_check(dll.DestroyProducer(self._handle))
-
     def send_sync(self, msg):
-        cres = _CSendResult()
-        ffi_check(dll.SendMessageSync(self._handle, msg, ctypes.pointer(cres)))
+        c_result = _CSendResult()
+        ffi_check(dll.SendMessageSync(self._handle, msg, ctypes.pointer(c_result)))
         return SendResult(
-            SendStatus(cres.sendStatus),
-            cres.msgId.decode('utf-8'),
-            cres.offset
+            SendStatus(c_result.sendStatus),
+            c_result.msgId.decode('utf-8'),
+            c_result.offset
         )
 
     def send_oneway(self, msg):
         ffi_check(dll.SendMessageOneway(self._handle, msg))
 
     def send_orderly_with_sharding_key(self, msg, sharding_key):
-        cres = _CSendResult()
-        ffi_check(dll.SendMessageOrderlyByShardingKey(self._handle, msg, _to_bytes(sharding_key), ctypes.pointer(cres)))
+        c_result = _CSendResult()
+        ffi_check(
+            dll.SendMessageOrderlyByShardingKey(self._handle, msg, _to_bytes(sharding_key), ctypes.pointer(c_result)))
         return SendResult(
-            SendStatus(cres.sendStatus),
-            cres.msgId.decode('utf-8'),
-            cres.offset
+            SendStatus(c_result.sendStatus),
+            c_result.msgId.decode('utf-8'),
+            c_result.offset
         )
 
     def set_group(self, group_name):
         ffi_check(dll.SetProducerGroupName(self._handle, _to_bytes(group_name)))
 
-    def set_namesrv_addr(self, addr):
+    def set_name_server_address(self, addr):
 
 Review comment:
   ok

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services