q66 pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3840aa453c6d24acaab5f25879ff20c7d50da3d3
commit 3840aa453c6d24acaab5f25879ff20c7d50da3d3 Author: Daniel Kolesa <[email protected]> Date: Mon Mar 12 15:48:25 2018 +0100 pyolian: update name APIs --- src/scripts/pyolian/eolian.py | 134 +++++++------------------------------- src/scripts/pyolian/eolian_lib.py | 86 ++---------------------- 2 files changed, 32 insertions(+), 188 deletions(-) diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 809ec35b2c..1d91d01f2d 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -292,18 +292,18 @@ class EolianBaseObject(object): if isinstance(other, EolianBaseObject): return self._obj.value == other._obj.value elif isinstance(other, str): - if hasattr(self, 'full_name'): - return self.full_name == other - elif hasattr(self, 'name'): + if hasattr(self, 'name'): return self.name == other + elif hasattr(self, 'short_name'): + return self.short_name == other return False def __gt__(self, other): if isinstance(other, EolianBaseObject): - if hasattr(self, 'full_name'): - return self.full_name > other.full_name - elif hasattr(self, 'name'): + if hasattr(self, 'name'): return self.name > other.name + elif hasattr(self, 'short_name'): + return self.short_name > other.short_name def __hash__(self): return self._obj.value @@ -633,6 +633,18 @@ class Object(EolianBaseObject): return _str_to_py(lib.eolian_object_name_get(self._obj)) @cached_property + def short_name(self): + return _str_to_py(lib.eolian_object_short_name_get(self._obj)) + + @property + def namespaces(self): + return Iterator(_str_to_py, lib.eolian_object_namespaces_get(self._obj)) + + @cached_property + def namespace(self): + return '.'.join(self.namespaces) + + @cached_property def file(self): return _str_to_py(lib.eolian_object_file_get(self._obj)) @@ -647,15 +659,7 @@ class Object(EolianBaseObject): class Class(Object): def __repr__(self): - return "<eolian.Class '{0.full_name}', {0.type!s}>".format(self) - - @cached_property - def name(self): - return _str_to_py(lib.eolian_class_name_get(self._obj)) - - @cached_property - def full_name(self): - return _str_to_py(lib.eolian_class_full_name_get(self._obj)) + return "<eolian.Class '{0.name}', {0.type!s}>".format(self) @cached_property def c_name(self): @@ -747,14 +751,6 @@ class Class(Object): if len(inherits) > 0: return inherits[0] - @property - def namespaces(self): - return Iterator(_str_to_py, lib.eolian_class_namespaces_get(self._obj)) - - @cached_property - def namespace(self): - return '.'.join(self.namespaces) - @cached_property def ctor_enable(self): return bool(lib.eolian_class_ctor_enable_get(self._obj)) @@ -795,10 +791,6 @@ class Part(Object): return "<eolian.Part '{0.name}'>".format(self) @cached_property - def name(self): - return _str_to_py(lib.eolian_part_name_get(self._obj)) - - @cached_property def class_(self): return Class(lib.eolian_part_class_get(self._obj)) @@ -810,11 +802,7 @@ class Part(Object): class Constructor(Object): def __repr__(self): - return "<eolian.Constructor '{0.full_name}', optional={0.is_optional}>".format(self) - - @cached_property - def full_name(self): - return _str_to_py(lib.eolian_constructor_full_name_get(self._obj)) + return "<eolian.Constructor '{0.name}', optional={0.is_optional}>".format(self) @cached_property def function(self): @@ -834,10 +822,6 @@ class Event(Object): return "<eolian.Event '{0.name}', c_name='{0.c_name}'>".format(self) @cached_property - def name(self): - return _str_to_py(lib.eolian_event_name_get(self._obj)) - - @cached_property def c_name(self): s = lib.eolian_event_c_name_get(self._obj) ret = _str_to_py(s) @@ -875,10 +859,6 @@ class Function(Object): def __repr__(self): return "<eolian.Function '{0.name}'>".format(self) - @cached_property - def name(self): - return _str_to_py(lib.eolian_function_name_get(self._obj)) - def full_c_name_get(self, ftype, use_legacy=False): s = lib.eolian_function_full_c_name_get(self._obj, ftype, use_legacy) ret = _str_to_py(s) @@ -1040,10 +1020,6 @@ class Function_Parameter(Object): " optional={0.is_optional}, nullable={0.is_nullable}>".format(self) @cached_property - def name(self): - return _str_to_py(lib.eolian_parameter_name_get(self._obj)) - - @cached_property def direction(self): return Eolian_Parameter_Dir(lib.eolian_parameter_direction_get(self._obj)) @@ -1077,11 +1053,7 @@ class Function_Parameter(Object): class Implement(Object): def __repr__(self): - return "<eolian.Implement '{0.full_name}'>".format(self) - - @cached_property - def full_name(self): - return _str_to_py(lib.eolian_implement_full_name_get(self._obj)) + return "<eolian.Implement '{0.name}'>".format(self) @cached_property def class_(self): @@ -1130,24 +1102,8 @@ class Implement(Object): class Type(Object): def __repr__(self): - # return "<eolian.Type '{0.full_name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self) - return "<eolian.Type '{0.full_name}', type={0.type!s}>".format(self) - - @cached_property - def name(self): - return _str_to_py(lib.eolian_type_name_get(self._obj)) - - @cached_property - def full_name(self): - return _str_to_py(lib.eolian_type_full_name_get(self._obj)) - - @property - def namespaces(self): - return Iterator(_str_to_py, lib.eolian_type_namespaces_get(self._obj)) - - @cached_property - def namespace(self): - return '.'.join(self.namespaces) + # return "<eolian.Type '{0.name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self) + return "<eolian.Type '{0.name}', type={0.type!s}>".format(self) @cached_property def free_func(self): @@ -1219,15 +1175,7 @@ class Type(Object): class Typedecl(Object): def __repr__(self): - return "<eolian.Typedecl '{0.full_name}', type={0.type!s}>".format(self) - - @cached_property - def name(self): - return _str_to_py(lib.eolian_typedecl_name_get(self._obj)) - - @cached_property - def full_name(self): - return _str_to_py(lib.eolian_typedecl_full_name_get(self._obj)) + return "<eolian.Typedecl '{0.name}', type={0.type!s}>".format(self) @cached_property def type(self): @@ -1240,14 +1188,6 @@ class Typedecl(Object): lib.eina_stringshare_del(c_void_p(s)) return ret - @property - def namespaces(self): - return Iterator(_str_to_py, lib.eolian_typedecl_namespaces_get(self._obj)) - - @cached_property - def namespace(self): - return '.'.join(self.namespaces) - @cached_property def free_func(self): return _str_to_py(lib.eolian_typedecl_free_func_get(self._obj)) @@ -1304,10 +1244,6 @@ class Enum_Type_Field(Object): return "<eolian.Enum_Type_Field '{0.name}', c_name='{0.c_name}'>".format(self) @cached_property - def name(self): - return _str_to_py(lib.eolian_typedecl_enum_field_name_get(self._obj)) - - @cached_property def c_name(self): s = lib.eolian_typedecl_enum_field_c_name_get(self._obj) ret = _str_to_py(s) @@ -1330,10 +1266,6 @@ class Struct_Type_Field(Object): return "<eolian.Struct_Type_Field '{0.name}', type={0.type!s}>".format(self) @cached_property - def name(self): - return _str_to_py(lib.eolian_typedecl_struct_field_name_get(self._obj)) - - @cached_property def type(self): c_type = lib.eolian_typedecl_struct_field_type_get(self._obj) return Type(c_type) if c_type else None @@ -1389,23 +1321,7 @@ class Expression(Object): class Variable(Object): def __repr__(self): - return "<eolian.Variable '{0.full_name}', type={0.type!s}, file={0.file}>".format(self) - - @cached_property - def name(self): - return _str_to_py(lib.eolian_variable_name_get(self._obj)) - - @cached_property - def full_name(self): - return _str_to_py(lib.eolian_variable_full_name_get(self._obj)) - - @property - def namespaces(self): - return Iterator(_str_to_py, lib.eolian_variable_namespaces_get(self._obj)) - - @cached_property - def namespace(self): - return '.'.join(self.namespaces) + return "<eolian.Variable '{0.name}', type={0.type!s}, file={0.file}>".format(self) @cached_property def type(self): diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py index 277f60afa1..9fb0a33142 100644 --- a/src/scripts/pyolian/eolian_lib.py +++ b/src/scripts/pyolian/eolian_lib.py @@ -265,19 +265,15 @@ lib.eolian_object_column_get.restype = c_int lib.eolian_object_name_get.argtypes = [c_void_p] lib.eolian_object_name_get.restype = c_char_p -### Eolian_Class ############################################################ - -# EAPI Eina_Stringshare *eolian_class_full_name_get(const Eolian_Class *klass); -lib.eolian_class_full_name_get.argtypes = [c_void_p,] -lib.eolian_class_full_name_get.restype = c_char_p +# EAPI const char *eolian_object_short_name_get(const Eolian_Object *obj); +lib.eolian_object_short_name_get.argtypes = [c_void_p] +lib.eolian_object_short_name_get.restype = c_char_p -# EAPI Eina_Stringshare *eolian_class_name_get(const Eolian_Class *klass); -lib.eolian_class_name_get.argtypes = [c_void_p,] -lib.eolian_class_name_get.restype = c_char_p +# EAPI Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj); +lib.eolian_object_namespaces_get.argtypes = [c_void_p] +lib.eolian_object_namespaces_get.restype = c_void_p -# EAPI Eina_Iterator *eolian_class_namespaces_get(const Eolian_Class *klass); -lib.eolian_class_namespaces_get.argtypes = [c_void_p,] -lib.eolian_class_namespaces_get.restype = c_void_p +### Eolian_Class ############################################################ # EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass); lib.eolian_class_type_get.argtypes = [c_void_p,] @@ -365,10 +361,6 @@ lib.eolian_function_type_get.restype = c_int lib.eolian_function_scope_get.argtypes = [c_void_p, c_int] lib.eolian_function_scope_get.restype = c_int -# EAPI Eina_Stringshare *eolian_function_name_get(const Eolian_Function *function_id); -lib.eolian_function_name_get.argtypes = [c_void_p,] -lib.eolian_function_name_get.restype = c_char_p - # EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype, Eina_Bool use_legacy); lib.eolian_function_full_c_name_get.argtypes = [c_void_p, c_int, c_bool] lib.eolian_function_full_c_name_get.restype = c_void_p # Stringshare TO BE FREED @@ -452,10 +444,6 @@ lib.eolian_parameter_type_get.restype = c_void_p lib.eolian_parameter_default_value_get.argtypes = [c_void_p,] lib.eolian_parameter_default_value_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_parameter_name_get(const Eolian_Function_Parameter *param); -lib.eolian_parameter_name_get.argtypes = [c_void_p,] -lib.eolian_parameter_name_get.restype = c_char_p - # EAPI const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian_Function_Parameter *param); lib.eolian_parameter_documentation_get.argtypes = [c_void_p,] lib.eolian_parameter_documentation_get.restype = c_void_p @@ -474,10 +462,6 @@ lib.eolian_parameter_is_optional.restype = c_bool ### Eolian_Implement ######################################################## -# EAPI Eina_Stringshare *eolian_implement_full_name_get(const Eolian_Implement *impl); -lib.eolian_implement_full_name_get.argtypes = [c_void_p,] -lib.eolian_implement_full_name_get.restype = c_char_p - # EAPI const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl); lib.eolian_implement_class_get.argtypes = [c_void_p,] lib.eolian_implement_class_get.restype = c_void_p @@ -512,10 +496,6 @@ lib.eolian_implement_is_prop_set.restype = c_bool ### Eolian_Constructor ###################################################### -# EAPI Eina_Stringshare *eolian_constructor_full_name_get(const Eolian_Constructor *ctor); -lib.eolian_constructor_full_name_get.argtypes = [c_void_p,] -lib.eolian_constructor_full_name_get.restype = c_char_p - # EAPI const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor); lib.eolian_constructor_class_get.argtypes = [c_void_p,] lib.eolian_constructor_class_get.restype = c_void_p @@ -530,10 +510,6 @@ lib.eolian_constructor_is_optional.restype = c_bool ### Eolian_Event ############################################################ -# EAPI Eina_Stringshare *eolian_event_name_get(const Eolian_Event *event); -lib.eolian_event_name_get.argtypes = [c_void_p,] -lib.eolian_event_name_get.restype = c_char_p - # EAPI Eina_Stringshare *eolian_event_c_name_get(const Eolian_Event *event); lib.eolian_event_c_name_get.argtypes = [c_void_p,] lib.eolian_event_c_name_get.restype = c_void_p # Stringshare TO BE FREED @@ -564,10 +540,6 @@ lib.eolian_event_is_restart.restype = c_bool ### Eolian_Part ############################################################# -# EAPI Eina_Stringshare *eolian_part_name_get(const Eolian_Part *part); -lib.eolian_part_name_get.argtypes = [c_void_p,] -lib.eolian_part_name_get.restype = c_char_p - # EAPI const Eolian_Class *eolian_part_class_get(const Eolian_Part *part); lib.eolian_part_class_get.argtypes = [c_void_p,] lib.eolian_part_class_get.restype = c_void_p @@ -590,10 +562,6 @@ lib.eolian_typedecl_struct_fields_get.restype = c_void_p lib.eolian_typedecl_struct_field_get.argtypes = [c_void_p, c_char_p] lib.eolian_typedecl_struct_field_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *fl); -lib.eolian_typedecl_struct_field_name_get.argtypes = [c_void_p,] -lib.eolian_typedecl_struct_field_name_get.restype = c_char_p - # EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl); lib.eolian_typedecl_struct_field_documentation_get.argtypes = [c_void_p,] lib.eolian_typedecl_struct_field_documentation_get.restype = c_void_p @@ -610,10 +578,6 @@ lib.eolian_typedecl_enum_fields_get.restype = c_void_p lib.eolian_typedecl_enum_field_get.argtypes = [c_void_p, c_char_p] lib.eolian_typedecl_enum_field_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *fl); -lib.eolian_typedecl_enum_field_name_get.argtypes = [c_void_p,] -lib.eolian_typedecl_enum_field_name_get.restype = c_char_p - # EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_name_get(const Eolian_Enum_Type_Field *fl); lib.eolian_typedecl_enum_field_c_name_get.argtypes = [c_void_p,] lib.eolian_typedecl_enum_field_c_name_get.restype = c_void_p # Stringshare TO BE FREED @@ -650,18 +614,6 @@ lib.eolian_typedecl_is_extern.restype = c_bool lib.eolian_typedecl_c_type_get.argtypes = [c_void_p,] lib.eolian_typedecl_c_type_get.restype = c_void_p # Stringshare TO BE FREED -# EAPI Eina_Stringshare *eolian_typedecl_name_get(const Eolian_Typedecl *tp); -lib.eolian_typedecl_name_get.argtypes = [c_void_p,] -lib.eolian_typedecl_name_get.restype = c_char_p - -# EAPI Eina_Stringshare *eolian_typedecl_full_name_get(const Eolian_Typedecl *tp); -lib.eolian_typedecl_full_name_get.argtypes = [c_void_p,] -lib.eolian_typedecl_full_name_get.restype = c_char_p - -# EAPI Eina_Iterator *eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp); -lib.eolian_typedecl_namespaces_get.argtypes = [c_void_p,] -lib.eolian_typedecl_namespaces_get.restype = c_void_p - # EAPI Eina_Stringshare *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp); lib.eolian_typedecl_free_func_get.argtypes = [c_void_p,] lib.eolian_typedecl_free_func_get.restype = c_char_p @@ -716,18 +668,6 @@ lib.eolian_type_is_ptr.restype = c_bool lib.eolian_type_c_type_get.argtypes = [c_void_p, c_int] lib.eolian_type_c_type_get.restype = c_void_p # Stringshare TO BE FREED -# EAPI Eina_Stringshare *eolian_type_name_get(const Eolian_Type *tp); -lib.eolian_type_name_get.argtypes = [c_void_p,] -lib.eolian_type_name_get.restype = c_char_p - -# EAPI Eina_Stringshare *eolian_type_full_name_get(const Eolian_Type *tp); -lib.eolian_type_full_name_get.argtypes = [c_void_p,] -lib.eolian_type_full_name_get.restype = c_char_p - -# EAPI Eina_Iterator *eolian_type_namespaces_get(const Eolian_Type *tp); -lib.eolian_type_namespaces_get.argtypes = [c_void_p,] -lib.eolian_type_namespaces_get.restype = c_void_p - # EAPI Eina_Stringshare *eolian_type_free_func_get(const Eolian_Type *tp); lib.eolian_type_free_func_get.argtypes = [c_void_p,] lib.eolian_type_free_func_get.restype = c_char_p @@ -780,18 +720,6 @@ lib.eolian_variable_base_type_get.restype = c_void_p lib.eolian_variable_value_get.argtypes = [c_void_p,] lib.eolian_variable_value_get.restype = c_void_p -# EAPI Eina_Stringshare *eolian_variable_name_get(const Eolian_Variable *var); -lib.eolian_variable_name_get.argtypes = [c_void_p,] -lib.eolian_variable_name_get.restype = c_char_p - -# EAPI Eina_Stringshare *eolian_variable_full_name_get(const Eolian_Variable *var); -lib.eolian_variable_full_name_get.argtypes = [c_void_p,] -lib.eolian_variable_full_name_get.restype = c_char_p - -# EAPI Eina_Iterator *eolian_variable_namespaces_get(const Eolian_Variable *var); -lib.eolian_variable_namespaces_get.argtypes = [c_void_p,] -lib.eolian_variable_namespaces_get.restype = c_void_p - # EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); lib.eolian_variable_is_extern.argtypes = [c_void_p,] lib.eolian_variable_is_extern.restype = c_bool --
