Skip to content

Commit

Permalink
JSON renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Mar 21, 2020
1 parent 7c82ee9 commit 6632075
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion api_dropbox/src/api_dropbox/system.py
Expand Up @@ -527,7 +527,7 @@ def files_put(self, file_path, target_path = None):
# fetches the retrieval URL with the given parameters retrieving the JSON
json = self._fetch_url(retrieval_url, parameters, PUT_METHOD_VALUE, file_contents)

# loads json retrieving the data
# loads JSON retrieving the data
data = self.json_plugin.loads(json)

# checks for Dropbox errors
Expand Down
4 changes: 2 additions & 2 deletions mvc/src/mvc/communication.py
Expand Up @@ -536,7 +536,7 @@ def _write_message(self, request, connection, message, data = ()):
the client as resulting meta information.
"""

# retrieves the json plugin
# retrieves the JSON plugin
json_plugin = self.mvc_plugin.json_plugin

# serializes the message and writes the serialized
Expand All @@ -546,7 +546,7 @@ def _write_message(self, request, connection, message, data = ()):
)
request.write(serialized_message)

# retrieves the mime type associated with the json
# retrieves the mime type associated with the JSON
# plugin and uses it to set the content type in the
# provided request object, then flushes the request
# so that the content type is set in it
Expand Down
4 changes: 2 additions & 2 deletions mvc/src/mvc/handlers/apn.py
Expand Up @@ -75,7 +75,7 @@

MESSAGE_TEMPLATE = "{\"aps\":{\"alert\":\"%s\",\"sound\":\"%s\",\"badge\":%d}}"
""" The template to be used to create the message
in case the json plugin is currently not available """
in case the JSON plugin is currently not available """

class APNHandler(handler.Handler):
"""
Expand Down Expand Up @@ -176,7 +176,7 @@ def handle(self, message):

# creates the message structure using with the
# message (string) as the alert and then converts
# it into a json format (payload)
# it into a JSON format (payload)
message_s = dict(
aps = dict(
alert = message,
Expand Down
36 changes: 18 additions & 18 deletions mvc/src/mvc_utils/controller.py
Expand Up @@ -1019,21 +1019,21 @@ def set_field(self, request, field_name, field_value):

def get_json(self, request):
"""
Retrieves the loaded json information from the request this
Retrieves the loaded JSON information from the request this
method assumes that the request is properly formed and that
the header information is set in accordance with json.
the header information is set in accordance with JSON.
:type request: Request
:param request: The request to be used.
:rtype: Object
:return: The object that represents the parsed json information
:return: The object that represents the parsed JSON information
that was passed inside the request data.
"""

# processes (and retrieves) the data map from the
# request and then tries to retrieves the json
# request and then tries to retrieves the JSON
# data from it in case it does not exists the complete
# maps is returned as the json value
# maps is returned as the JSON value
form_data_map = self.process_json_data(request)
json_v = form_data_map.get("root", form_data_map)
return json_v
Expand Down Expand Up @@ -1361,23 +1361,23 @@ def create_form_data(self, request, data_map, encoding = "utf-8"):

def process_json_data(self, request, encoding = "utf-8", force = False):
"""
Processes the json data (attributes), creating a map containing
the hierarchy of defined structure for the "json" contents.
Processes the JSON data (attributes), creating a map containing
the hierarchy of defined structure for the "JSON" contents.
Note that the encoding argument controls the encoding to be used
while decoding the request data for json loading.
while decoding the request data for JSON loading.
:type request: Request
:param request: The request to be used.
:type encoding: String
:param encoding: The encoding to be used when decoding the request
data/payload so that it can be used in json loading operation.
data/payload so that it can be used in JSON loading operation.
:type force: bool
:param force: If any cached data should be discarded and the
the request information re-parsed if necessary.
:rtype: Dictionary
:return: The map containing the hierarchy of defined structure
for the "json" contents.
for the "JSON" contents.
"""

# tries to retrieves the base attributes map from the
Expand All @@ -1390,10 +1390,10 @@ def process_json_data(self, request, encoding = "utf-8", force = False):
if not force and data_map: return data_map

# reads the contents from the request and then "loads"
# the json structure from them, in case the value is not a
# the JSON structure from them, in case the value is not a
# dictionary converts it into one settings the loaded contents
# in a new dictionary "under" the root key value then stores the result
# in the private json data value and returns the data map
# in the private JSON data value and returns the data map
contents = request.read()
is_bytes = colony.legacy.is_bytes(contents)
if is_bytes: contents = contents.decode(encoding)
Expand Down Expand Up @@ -4287,10 +4287,10 @@ def set_engines(self, engines):

def set_json_plugin(self, json_plugin):
"""
Sets the json plugin.
Sets the JSON plugin.
:type json_plugin: Plugin
:param json_plugin: The json plugin.
:param json_plugin: The JSON plugin.
"""

self.json_plugin = json_plugin
Expand Down Expand Up @@ -5504,7 +5504,7 @@ def _get_bundle(self, locale, bundle_name = "global"):
base_path = os.path.join(locales_path, bundle_file)

# constructs the bundle path from the locales path and
# the expected bundle name (assumes json type), in case
# the expected bundle name (assumes JSON type), in case
# such path does not exists returns immediately, note that
# the base resource is used first as fallback process
bundle_path = os.path.join(self.locales_path, bundle_file)
Expand All @@ -5519,12 +5519,12 @@ def _get_bundle(self, locale, bundle_name = "global"):
if bundle: return bundle

# opens the bundle file for reading of its contents
# after the reading they will be processed as json
# after the reading they will be processed as JSON
bundle_file = open(bundle_path, "rb")

try:
# reads the bundle file contents and loads them
# as json information, (map) decoding it using
# as JSON information, (map) decoding it using
# the default encoding (utf-8)
bundle_contents = bundle_file.read()
bundle_contents = bundle_contents.decode("utf-8")
Expand All @@ -5535,7 +5535,7 @@ def _get_bundle(self, locale, bundle_name = "global"):
bundle_file.close()

# adds the bundle to the cache map using the last retrieved
# timestamp and the parsed bundle json data, this will allow
# timestamp and the parsed bundle JSON data, this will allow
# the next retrieval to be done through the cache system
bundle_cache.add(bundle_path, bundle, bundle_timestamp)

Expand Down
2 changes: 1 addition & 1 deletion mvc/src/mvc_utils/system.py
Expand Up @@ -292,7 +292,7 @@ def create_controller(
_controller.set_template_engine_plugin(template_engine_plugin)
_controller.set_engines(engines)

# sets the template engine plugin and the json plugins
# sets the template engine plugin and the JSON plugins
# in the controller, this are required for proper usage
# of the controller according to specification
_controller.set_template_engine_plugin(template_engine_plugin)
Expand Down
12 changes: 6 additions & 6 deletions nanger/src/nanger/controllers/console.py
Expand Up @@ -96,7 +96,7 @@ def init(self, request):
# in the current context
plugin_manager = self.plugin.manager

# retrieves the json plugin for the encoding of the
# retrieves the JSON plugin for the encoding of the
# response value (serialized value)
json_plugin = self.plugin.json_plugin

Expand Down Expand Up @@ -170,7 +170,7 @@ def init(self, request):
result_err = buffer_err.getvalue()
result = result_err or result_out

# creates the response map and serializes it with json to create the
# creates the response map and serializes it with JSON to create the
# final result contents, should retrieve the appropriate mime type
response = dict(
result = result,
Expand All @@ -192,7 +192,7 @@ def execute(self, request):
# in the current context
plugin_manager = self.plugin.manager

# retrieves the json plugin for the encoding of the
# retrieves the JSON plugin for the encoding of the
# response value (serialized value)
json_plugin = self.plugin.json_plugin

Expand Down Expand Up @@ -285,7 +285,7 @@ def execute(self, request):
result_err = buffer_err.getvalue()
result = result_err or result_out

# creates the response map and serializes it with json to create the
# creates the response map and serializes it with JSON to create the
# final result contents, should retrieve the appropriate mime type
response = dict(
result = result,
Expand All @@ -308,7 +308,7 @@ def autocomplete(self, request):
# in the current context
plugin_manager = self.plugin.manager

# retrieves the json plugin for the encoding of the
# retrieves the JSON plugin for the encoding of the
# response value (serialized value)
json_plugin = self.plugin.json_plugin

Expand Down Expand Up @@ -425,7 +425,7 @@ def autocomplete(self, request):
# that they are presented to the end user in the best way possible
commands.sort()

# creates the response map and serializes it with json to create the
# creates the response map and serializes it with JSON to create the
# final result contents, should retrieve the appropriate mime type
response = dict(
result = commands,
Expand Down
6 changes: 3 additions & 3 deletions nanger/src/nanger/controllers/diagnostics.py
Expand Up @@ -72,11 +72,11 @@ def requests(self, request):
)

def requests_list(self, request):
# retrieves the json plugin for the encoding of the
# retrieves the JSON plugin for the encoding of the
# response value (serialized value)
json_plugin = self.plugin.json_plugin

# retrieves the json plugin to be used for the retrieval
# retrieves the JSON plugin to be used for the retrieval
# of the diagnostics information to be shown
diagnostics_plugin = self.plugin.diagnostics_plugin

Expand Down Expand Up @@ -131,7 +131,7 @@ def requests_list(self, request):
self.serialize(request, requests, serializer = json_plugin)

def requests_show(self, request, request_id = None):
# retrieves the json plugin to be used for the retrieval
# retrieves the JSON plugin to be used for the retrieval
# of the diagnostics information to be shown
diagnostics_plugin = self.plugin.diagnostics_plugin

Expand Down
2 changes: 1 addition & 1 deletion nanger/src/nanger/controllers/plugin.py
Expand Up @@ -50,7 +50,7 @@ def list(self, request):
# in the current context
plugin_manager = self.plugin.manager

# retrieves the json plugin for the encoding of the
# retrieves the JSON plugin for the encoding of the
# response value (serialized value)
json_plugin = self.plugin.json_plugin

Expand Down

0 comments on commit 6632075

Please sign in to comment.