From 985d6d8dddd1e9ff1328575e068338ad43211643 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 18:24:10 +0200 Subject: add more docstrings to registry python module (This used to be commit 606f92db874c139ba532df53a87cc5b826215d9e) --- source4/lib/registry/registry.i | 24 +++++++++++++++ source4/lib/registry/registry.py | 60 +++++++++++++++++++++++++++++++++--- source4/lib/registry/registry_wrap.c | 30 ++++++++++++------ 3 files changed, 100 insertions(+), 14 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 5ffee4bb3d..7dd02b344c 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -93,11 +93,20 @@ WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx); typedef struct registry_context { %extend { + %feature("docstring") get_predefined_key_by_name "S.get_predefined_key_by_name(name) -> key\n" + "Find a predefined key by name"; WERROR get_predefined_key_by_name(const char *name, struct registry_key **key); + %feature("docstring") key_del_abs "S.key_del_abs(name) -> None\n" + "Delete a key by absolute path."; WERROR key_del_abs(const char *path); + %feature("docstring") get_predefined_key "S.get_predefined_key(hkey_id) -> key\n" + "Find a predefined key by id"; WERROR get_predefined_key(uint32_t hkey_id, struct registry_key **key); + %feature("docstring") diff_apply "S.diff_apply(filename) -> None\n" + "Apply the diff from the specified file"; + WERROR diff_apply(const char *filename); WERROR generate_diff(struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks, void *callback_data); @@ -106,6 +115,8 @@ typedef struct registry_context { const char **elements=NULL); struct registry_key *import_hive_key(struct hive_key *hive, uint32_t predef_key, const char **elements); + %feature("docstring") mount_hive "S.mount_hive(key, predef_name) -> None\n" + "Mount the specified key at the specified path."; WERROR mount_hive(struct hive_key *key, const char *predef_name) { int i; @@ -130,6 +141,7 @@ typedef struct registry_context { $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_hive_key, 0); } +%feature("docstring") reg_open_hive "S.__init__(location, session_info=None, credentials=None, loadparm_context=None)"; %rename(hive_key) reg_open_hive; WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, @@ -138,6 +150,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct loadparm_context *lp_ctx, struct hive_key **root); +%feature("docstring") reg_open_ldb_file "open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key"; %rename(open_ldb) reg_open_ldb_file; WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, @@ -146,10 +159,12 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct loadparm_context *lp_ctx, struct hive_key **k); +%feature("docstring") reg_create_directory "create_dir(location) -> key"; %rename(create_dir) reg_create_directory; WERROR reg_create_directory(TALLOC_CTX *parent_ctx, const char *location, struct hive_key **key); +%feature("docstring") reg_open_directory "open_dir(location) -> key"; %rename(open_dir) reg_open_directory; WERROR reg_open_directory(TALLOC_CTX *parent_ctx, const char *location, struct hive_key **key); @@ -158,15 +173,24 @@ WERROR reg_open_directory(TALLOC_CTX *parent_ctx, typedef struct hive_key { %extend { + %feature("docstring") del "S.del(name) -> None\n" + "Delete a subkey"; WERROR del(const char *name); + %feature("docstring") flush "S.flush() -> None\n" + "Flush this key to disk"; WERROR flush(void); + %feature("docstring") del_value "S.del_value(name) -> None\n" + "Delete a value"; WERROR del_value(const char *name); + %feature("docstring") set_value "S.set_value(name, type, data) -> None\n" + "Set a value"; WERROR set_value(const char *name, uint32_t type, const DATA_BLOB data); } } hive_key; %rename(open_samba) reg_open_samba; +%feature("docstring") reg_open_samba "open_samba() -> reg"; WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, struct event_context *ev_ctx, diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index cb20d6039d..4c6e735414 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -66,6 +66,41 @@ Registry = _registry.Registry class reg(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr + def get_predefined_key_by_name(*args, **kwargs): + """ + S.get_predefined_key_by_name(name) -> key + Find a predefined key by name + """ + return _registry.reg_get_predefined_key_by_name(*args, **kwargs) + + def key_del_abs(*args, **kwargs): + """ + S.key_del_abs(name) -> None + Delete a key by absolute path. + """ + return _registry.reg_key_del_abs(*args, **kwargs) + + def get_predefined_key(*args, **kwargs): + """ + S.get_predefined_key(hkey_id) -> key + Find a predefined key by id + """ + return _registry.reg_get_predefined_key(*args, **kwargs) + + def diff_apply(*args, **kwargs): + """ + S.diff_apply(filename) -> None + Apply the diff from the specified file + """ + return _registry.reg_diff_apply(*args, **kwargs) + + def mount_hive(*args): + """ + S.mount_hive(key, predef_name) -> None + Mount the specified key at the specified path. + """ + return _registry.reg_mount_hive(*args) + def __init__(self, *args, **kwargs): _registry.reg_swiginit(self,_registry.new_reg(*args, **kwargs)) __swig_destroy__ = _registry.delete_reg @@ -79,11 +114,26 @@ reg.mount_hive = new_instancemethod(_registry.reg_mount_hive,None,reg) reg_swigregister = _registry.reg_swigregister reg_swigregister(reg) -hive_key = _registry.hive_key -open_ldb = _registry.open_ldb -create_dir = _registry.create_dir -open_dir = _registry.open_dir -open_samba = _registry.open_samba + +def hive_key(*args, **kwargs): + """S.__init__(location, session_info=None, credentials=None, loadparm_context=None)""" + return _registry.hive_key(*args, **kwargs) + +def open_ldb(*args, **kwargs): + """open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key""" + return _registry.open_ldb(*args, **kwargs) + +def create_dir(*args, **kwargs): + """create_dir(location) -> key""" + return _registry.create_dir(*args, **kwargs) + +def open_dir(*args, **kwargs): + """open_dir(location) -> key""" + return _registry.open_dir(*args, **kwargs) + +def open_samba(*args, **kwargs): + """open_samba() -> reg""" + return _registry.open_samba(*args, **kwargs) HKEY_CLASSES_ROOT = _registry.HKEY_CLASSES_ROOT HKEY_CURRENT_USER = _registry.HKEY_CURRENT_USER HKEY_LOCAL_MACHINE = _registry.HKEY_LOCAL_MACHINE diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index d9b85ee937..b066e42b41 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -3798,10 +3798,22 @@ static PyMethodDef SwigMethods[] = { { (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Registry", (PyCFunction)_wrap_Registry, METH_NOARGS, NULL}, - { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"reg_diff_apply", (PyCFunction) _wrap_reg_diff_apply, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.get_predefined_key_by_name(name) -> key\n" + "Find a predefined key by name\n" + ""}, + { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.key_del_abs(name) -> None\n" + "Delete a key by absolute path.\n" + ""}, + { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.get_predefined_key(hkey_id) -> key\n" + "Find a predefined key by id\n" + ""}, + { (char *)"reg_diff_apply", (PyCFunction) _wrap_reg_diff_apply, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.diff_apply(filename) -> None\n" + "Apply the diff from the specified file\n" + ""}, { (char *)"reg_generate_diff", (PyCFunction) _wrap_reg_generate_diff, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_import_hive_key", (PyCFunction) _wrap_reg_import_hive_key, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"reg_mount_hive", _wrap_reg_mount_hive, METH_VARARGS, NULL}, @@ -3809,11 +3821,11 @@ static PyMethodDef SwigMethods[] = { { (char *)"delete_reg", (PyCFunction)_wrap_delete_reg, METH_O, NULL}, { (char *)"reg_swigregister", reg_swigregister, METH_VARARGS, NULL}, { (char *)"reg_swiginit", reg_swiginit, METH_VARARGS, NULL}, - { (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, (char *)"S.__init__(location, session_info=None, credentials=None, loadparm_context=None)"}, + { (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, (char *)"open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key"}, + { (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, (char *)"create_dir(location) -> key"}, + { (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, (char *)"open_dir(location) -> key"}, + { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, (char *)"open_samba() -> reg"}, { NULL, NULL, 0, NULL } }; -- cgit