Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def action(self, ctx, *args, **params):
action = ctx.info_name
params_tmp = self.srv_info[action][self.PARAMS]
params = self._param_encode(params, params_tmp)
pwd = os.path.dirname(os.path.abspath(__file__))
filename = self.srv_info[action]["filename"] + ".js"
path = os.path.join(pwd, "events", self.service, filename)
with io.open(path, encoding="utf-8") as f:
data = f.read().strip()
data = renderer.render(data, params)
click.secho(json.dumps(json.loads(data), indent=2))
tags = self.event_mapping[service_name][event_type]["tags"]
values_to_sub = self.encode(tags, "encoding", values_to_sub)
# construct the path to the Events json file
this_folder = os.path.dirname(os.path.abspath(__file__))
file_name = self.event_mapping[service_name][event_type]["filename"] + ".json"
file_path = os.path.join(this_folder, "events", service_name, file_name)
# open the file
with open(file_path) as f:
data = json.load(f)
data = json.dumps(data, indent=2)
# return the substituted file
return renderer.render(data, values_to_sub)
def action(self, ctx, *args, **params):
action = ctx.info_name
params_tmp = self.srv_info[action][self.PARAMS]
params = self._param_encode(params, params_tmp)
pwd = os.path.dirname(os.path.abspath(__file__))
filename = self.srv_info[action]["filename"] + ".js"
path = os.path.join(pwd, "events", self.service, filename)
with io.open(path, encoding="utf-8") as f:
data = f.read().strip()
data = renderer.render(data, params)
Operation(json.dumps(json.loads(data), indent=2)).echo()