Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 3fd01ee

Browse files
author
Ron Quan
committed
Fixed typo in readme.md and converted double quotes to single quotes in json_rpc.py
1 parent 22f4e1c commit 3fd01ee

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/common/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Microsoft XPlat Cli common module
1+
Microsoft XPlat CLI common module
22
=================================

src/common/json_rpc.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Json_Rpc_Writer(object):
1616
Writes to the supplied stream through the JSON RPC Protocol where a request is formatted through a method
1717
name and the necessary parameters.
1818
"""
19-
HEADER = "Content-Length: {0}\r\n\r\n"
19+
HEADER = 'Content-Length: {0}\r\n\r\n'
2020

2121
def __init__(self, stream, encoding = None):
2222
self.stream = stream
@@ -30,10 +30,10 @@ def send_request(self, method, params, id = None):
3030
"""
3131
# Perhaps move to a different def to add some validation
3232
content_body = {
33-
"jsonrpc": "2.0",
34-
"method": method,
35-
"params": params,
36-
"id": id
33+
'jsonrpc': '2.0',
34+
'method': method,
35+
'params': params,
36+
'id': id
3737
}
3838

3939
json_content = json.dumps(content_body)
@@ -80,7 +80,7 @@ def read_response(self):
8080
if the body-content can not be serialized to a JSON object
8181
"""
8282
# Using a mutable list to hold the value since a immutable string passed by reference won't change the value
83-
content = [""]
83+
content = ['']
8484
while (self.read_next_chunk()):
8585
# If we can't read a header, read the next chunk
8686
if (self.read_state is Read_State.Header and not self.try_read_headers()):
@@ -162,7 +162,7 @@ def try_read_headers(self):
162162
colon_index = header.find(':')
163163

164164
if (colon_index == -1):
165-
raise KeyError("Colon missing from Header: {0}.".format(header))
165+
raise KeyError('Colon missing from Header: {0}.'.format(header))
166166

167167
# Making all headers lowercase to support case insensitivity
168168
header_key = header[:colon_index].lower()
@@ -171,10 +171,10 @@ def try_read_headers(self):
171171
self.headers[header_key] = header_value
172172

173173
#Find content body in the list of headers and parse the Value
174-
if (not ("content-length" in self.headers)):
175-
raise LookupError("Content-Length was not found in headers received.")
174+
if (not ('content-length' in self.headers)):
175+
raise LookupError('Content-Length was not found in headers received.')
176176

177-
self.expected_content_length = int(self.headers["content-length"])
177+
self.expected_content_length = int(self.headers['content-length'])
178178

179179
except ValueError:
180180
# Content-length contained invalid literal for int

0 commit comments

Comments
 (0)