Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
or keyword arguments, not mixed.
"""
try:
assert(not hasattr(RequestHandler, method_name))
print method_name
method = self
method_list = dir(method)
method_list.sort()
attr_tree = method_name.split('.')
for attr_name in attr_tree:
method = self._RPC_.check_method(attr_name, method)
assert(callable(method))
assert(not method_name.startswith('_'))
assert(not getattr(method, 'private', False))
except Exception,e :
raise gen.Return(self._RPC_.faults.method_not_found())
args = []
kwargs = {}
try:
if isinstance(params, dict):
# The parameters are keyword-based
kwargs = params
elif type(params) in (list, tuple):
# The parameters are positional
args = params
else:
# Bad argument formatting?
raise Exception()
# Validating call arguments
final_kwargs, extra_args = getcallargs(method, *args, **kwargs)
except Exception:
:rtype: list
"""
cursor = self.collection.find(query)
if orderby:
cursor.sort(orderby, order_by_direction)
cursor.skip(page*limit).limit(limit)
results = []
while (yield cursor.fetch_next):
results.append(self._obj_cursor_to_dictionary(cursor.next_object()))
raise Return(results)
def wrapper(*args, **kwargs):
raise tornado.gen.Return(fct(*args, **kwargs))
def _compare_operational_bindings(self):
raise gen.Return(self._compare_bindings(
self.desired_operational_bindings,
self.operational_bindings))
def _get_proxied_ws(self):
if not self._proxied_ws_future:
raise gen.Return()
try:
client = yield self._proxied_ws_future
except Exception as e: # pylint:disable=broad-except
self._on_unhandled_exception(e)
else:
raise gen.Return(client)
if secret != super_secret:
raise gen.Return("Error: bad secret")
if pg_connection_wrapper:
with pg_connection_wrapper.get_connection() as pg_connection:
with pg_connection.cursor() as pg_cursor:
pg_cursor.execute(
'SELECT enabled FROM "{table}" '
'WHERE email = %(user)s'
.format(table=table_name),
vars={'user': user}
)
result = pg_cursor.fetchone()
if not result:
raise gen.Return("false")
raise gen.Return(str(result[0]).lower())
try:
result = yield db.get_entity(USER_TABLE, user, ['enabled'])
except AppScaleDBConnectionError as db_error:
raise gen.Return('Error: {}'.format(db_error))
if result[0] not in ERROR_CODES or len(result) == 1:
raise gen.Return("false")
raise gen.Return(result[1])
def is_deactivated(self, project_id, user_id):
key = self.get_deactivated_key(project_id, user_id)
try:
data = yield Task(self.client.get, key)
except StreamClosedError as e:
raise Return((None, e))
else:
result = False
if data:
result = True
raise Return((result, None))
def update(self, doc):
doc = replace_dots(doc)
doc_copy = deepcopy(doc)
doc_copy.pop('_id')
result = yield self.col.update({
'_id': ObjectId(doc['_id'])
}, {
'$set': doc_copy
})
self.signals.send_catch_log(site_updated, site=doc)
raise Return(result)
else:
timeout=0.0
try:
with (yield self.post_processor_lock.acquire(timeout)):
result = []
for text in texts:
self.post_processor.stdin.write("%s\n" % text.encode("utf-8"))
self.post_processor.stdin.flush()
logging.debug("%s: Starting postprocessing: %s" % (self.request_id, text))
text = yield self.post_processor.stdout.read_until('\n')
text = text.decode("utf-8")
logging.debug("%s: Postprocessing returned: %s" % (self.request_id, text))
text = text.strip()
text = text.replace("\\n", "\n")
result.append(text)
raise tornado.gen.Return(result)
except tornado.gen.TimeoutError:
logging.debug("%s: Skipping postprocessing since post-processor already in use" % (self.request_id))
raise tornado.gen.Return(None)
else:
raise tornado.gen.Return(texts)
def _data_ns(self, tr, project_id, namespace):
directory = yield self._directory_cache.get(
tr, DataNamespace.directory_path(project_id, namespace))
raise gen.Return(DataNamespace(directory))