Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __make_default_annotation (self, annotation, value):
return GIAnnotation ("default %s" % str (value[0]), DEFAULT_HELP)
def __make_allow_none_annotation(self, annotation, value):
return GIAnnotation ("allow-none", ALLOW_NONE_HELP)
def __make_array_annotation (self, annotation, value):
annotation_val = None
if type(value) == dict:
annotation_val = ""
for name, val in value.items():
annotation_val += "%s=%s" % (name, val)
return GIAnnotation ("array", ARRAY_HELP, annotation_val)
def __make_transfer_annotation(self, annotation, value):
if value[0] == "none":
return GIAnnotation ("transfer: none", TRANSFER_NONE_HELP)
elif value[0] == "full":
return GIAnnotation ("transfer: full", TRANSFER_FULL_HELP)
elif value[0] == "floating":
return GIAnnotation ("transfer: floating", TRANSFER_FLOATING_HELP)
elif value[0] == "container":
return GIAnnotation ("transfer: container", TRANSFER_CONTAINER_HELP)
else:
return None
def __make_not_nullable_annotation(self):
return GIAnnotation("not nullable", NOT_NULLABLE_HELP)
def __make_out_annotation (self, annotation, value):
return GIAnnotation ("out", DIRECTION_OUT_HELP)
def __make_scope_annotation (self, annotation, value):
if type (value) != list or not value:
return None
if value[0] == "async":
return GIAnnotation ("scope async", SCOPE_ASYNC_HELP)
elif value[0] == "call":
return GIAnnotation ("scope call", SCOPE_CALL_HELP)
elif value[0] == 'notified':
return GIAnnotation ("scope notified", SCOPE_NOTIFIED_HELP)
return None
def __make_transfer_annotation(self, annotation, value):
if value[0] == "none":
return GIAnnotation ("transfer: none", TRANSFER_NONE_HELP)
elif value[0] == "full":
return GIAnnotation ("transfer: full", TRANSFER_FULL_HELP)
elif value[0] == "floating":
return GIAnnotation ("transfer: floating", TRANSFER_FLOATING_HELP)
elif value[0] == "container":
return GIAnnotation ("transfer: container", TRANSFER_CONTAINER_HELP)
else:
return None
def __make_destroy_annotation (self, annotation, value):
if value:
return GIAnnotation ("destroy %s" % str (value[0]), DESTROY_HELP)
else:
return GIAnnotation ("destroy", DESTROY_HELP)
def __make_transfer_annotation(self, annotation, value):
if value[0] == "none":
return GIAnnotation ("transfer: none", TRANSFER_NONE_HELP)
elif value[0] == "full":
return GIAnnotation ("transfer: full", TRANSFER_FULL_HELP)
elif value[0] == "floating":
return GIAnnotation ("transfer: floating", TRANSFER_FLOATING_HELP)
elif value[0] == "container":
return GIAnnotation ("transfer: container", TRANSFER_CONTAINER_HELP)
else:
return None