diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-05-22 18:13:48 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-05-23 00:37:46 +0200 |
commit | 90471951285465130dba73b3c6c3acc912e751d6 (patch) | |
tree | 58631756d721ffb4b6af19b39d60f6fb74732294 /source4/param | |
parent | b8310221c60e75fc8fe9764958213033cc43fb84 (diff) | |
download | samba-90471951285465130dba73b3c6c3acc912e751d6.tar.gz samba-90471951285465130dba73b3c6c3acc912e751d6.tar.xz samba-90471951285465130dba73b3c6c3acc912e751d6.zip |
Add docstrings to param python module.
(This used to be commit 39d27088e51867705ceec356759e7c3609a102bf)
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/param.i | 26 | ||||
-rw-r--r-- | source4/param/param.py | 70 | ||||
-rw-r--r-- | source4/param/param_wrap.c | 50 |
3 files changed, 136 insertions, 10 deletions
diff --git a/source4/param/param.i b/source4/param/param.i index 2f62cb2f16a..2c15f8f5e38 100644 --- a/source4/param/param.i +++ b/source4/param/param.i @@ -50,22 +50,36 @@ typedef struct loadparm_context { %extend { loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); } struct loadparm_service *default_service() { return lp_default_service($self); } + %feature("docstring") load "S.load(filename) -> None\n" \ + "Load specified file."; bool load(const char *filename) { return lp_load($self, filename); } + %feature("docstring") load_default "S.load_default() -> None\n" \ + "Load default smb.conf file."; bool load_default() { return lp_load_default($self); } #ifdef SWIGPYTHON int __len__() { return lp_numservices($self); } struct loadparm_service *__getitem__(const char *name) { return lp_service($self, name); } #endif + %feature("docstring") configfile "S.configfile() -> string\n" \ + "Return name of last config file that was loaded."; const char *configfile() { return lp_configfile($self); } + %feature("docstring") is_mydomain "S.is_mydomain(domain_name) -> bool\n" \ + "Check whether the specified name matches our domain name."; bool is_mydomain(const char *domain) { return lp_is_mydomain($self, domain); } + %feature("docstring") is_myname "S.is_myname(netbios_name) -> bool\n" \ + "Check whether the specified name matches one of our netbios names."; bool is_myname(const char *name) { return lp_is_myname($self, name); } int use(struct param_context *param_ctx) { return param_use($self, param_ctx); } + %feature("docstring") set "S.set(name, value) -> bool\n" \ + "Change a parameter."; bool set(const char *parm_name, const char *parm_value) { if (parm_value == NULL) return false; return lp_set_cmdline($self, parm_name, parm_value); } + %feature("docstring") set "S.get(name, service_name) -> value\n" \ + "Find specified parameter."; PyObject *get(const char *param_name, const char *service_name) { struct parm_struct *parm = NULL; @@ -180,7 +194,11 @@ typedef struct loadparm_service { typedef struct param_context { %extend { param(TALLOC_CTX *mem_ctx) { return param_init(mem_ctx); } + %feature("docstring") add_section "S.get_section(name) -> section\n" + "Get an existing section."; struct param_section *get_section(const char *name); + %feature("docstring") add_section "S.add_section(name) -> section\n" + "Add a new section."; struct param_section *add_section(const char *name); struct param_opt *get(const char *name, const char *section_name="global"); const char *get_string(const char *name, const char *section_name="global"); @@ -198,10 +216,18 @@ typedef struct param_context { #endif + %feature("docstring") first_section "S.first_section() -> section\n" + "Find first section"; struct param_section *first_section() { return $self->sections; } + %feature("docstring") next_section "S.next_section(prev) -> section\n" + "Find next section"; struct param_section *next_section(struct param_section *s) { return s->next; } + %feature("docstring") read "S.read(filename) -> bool\n" + "Read a filename."; int read(const char *fn); + %feature("docstring") read "S.write(filename) -> bool\n" + "Write this object to a file."; int write(const char *fn); } %pythoncode { diff --git a/source4/param/param.py b/source4/param/param.py index 0419c75bfa4..3aebaf0e021 100644 --- a/source4/param/param.py +++ b/source4/param/param.py @@ -62,6 +62,48 @@ class LoadParm(object): __repr__ = _swig_repr def __init__(self, *args, **kwargs): _param.LoadParm_swiginit(self,_param.new_LoadParm(*args, **kwargs)) + def load(*args, **kwargs): + """ + S.load(filename) -> None + Load specified file. + """ + return _param.LoadParm_load(*args, **kwargs) + + def load_default(*args, **kwargs): + """ + S.load_default() -> None + Load default smb.conf file. + """ + return _param.LoadParm_load_default(*args, **kwargs) + + def configfile(*args, **kwargs): + """ + S.configfile() -> string + Return name of last config file that was loaded. + """ + return _param.LoadParm_configfile(*args, **kwargs) + + def is_mydomain(*args, **kwargs): + """ + S.is_mydomain(domain_name) -> bool + Check whether the specified name matches our domain name. + """ + return _param.LoadParm_is_mydomain(*args, **kwargs) + + def is_myname(*args, **kwargs): + """ + S.is_myname(netbios_name) -> bool + Check whether the specified name matches one of our netbios names. + """ + return _param.LoadParm_is_myname(*args, **kwargs) + + def set(*args, **kwargs): + """ + S.set(name, value) -> bool + Change a parameter. + """ + return _param.LoadParm_set(*args, **kwargs) + __swig_destroy__ = _param.delete_LoadParm LoadParm.default_service = new_instancemethod(_param.LoadParm_default_service,None,LoadParm) LoadParm.load = new_instancemethod(_param.LoadParm_load,None,LoadParm) @@ -92,6 +134,34 @@ class ParamFile(object): __repr__ = _swig_repr def __init__(self, *args, **kwargs): _param.ParamFile_swiginit(self,_param.new_ParamFile(*args, **kwargs)) + def add_section(*args, **kwargs): + """ + S.add_section(name) -> section + Add a new section. + """ + return _param.ParamFile_add_section(*args, **kwargs) + + def first_section(*args, **kwargs): + """ + S.first_section() -> section + Find first section + """ + return _param.ParamFile_first_section(*args, **kwargs) + + def next_section(*args, **kwargs): + """ + S.next_section(prev) -> section + Find next section + """ + return _param.ParamFile_next_section(*args, **kwargs) + + def read(*args, **kwargs): + """ + S.read(filename) -> bool + Read a filename. + """ + return _param.ParamFile_read(*args, **kwargs) + def __getitem__(self, name): ret = self.get_section(name) if ret is None: diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c index d07be04a669..aff239312d5 100644 --- a/source4/param/param_wrap.c +++ b/source4/param/param_wrap.c @@ -4168,15 +4168,33 @@ SWIGINTERN PyObject *Swig_var_default_config_get(void) { static PyMethodDef SwigMethods[] = { { (char *)"new_LoadParm", (PyCFunction)_wrap_new_LoadParm, METH_NOARGS, NULL}, { (char *)"LoadParm_default_service", (PyCFunction) _wrap_LoadParm_default_service, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"LoadParm_load", (PyCFunction) _wrap_LoadParm_load, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"LoadParm_load_default", (PyCFunction) _wrap_LoadParm_load_default, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"LoadParm_load", (PyCFunction) _wrap_LoadParm_load, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.load(filename) -> None\n" + "Load specified file.\n" + ""}, + { (char *)"LoadParm_load_default", (PyCFunction) _wrap_LoadParm_load_default, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.load_default() -> None\n" + "Load default smb.conf file.\n" + ""}, { (char *)"LoadParm___len__", (PyCFunction) _wrap_LoadParm___len__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"LoadParm___getitem__", (PyCFunction) _wrap_LoadParm___getitem__, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"LoadParm_configfile", (PyCFunction) _wrap_LoadParm_configfile, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"LoadParm_is_mydomain", (PyCFunction) _wrap_LoadParm_is_mydomain, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"LoadParm_is_myname", (PyCFunction) _wrap_LoadParm_is_myname, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"LoadParm_configfile", (PyCFunction) _wrap_LoadParm_configfile, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.configfile() -> string\n" + "Return name of last config file that was loaded.\n" + ""}, + { (char *)"LoadParm_is_mydomain", (PyCFunction) _wrap_LoadParm_is_mydomain, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.is_mydomain(domain_name) -> bool\n" + "Check whether the specified name matches our domain name.\n" + ""}, + { (char *)"LoadParm_is_myname", (PyCFunction) _wrap_LoadParm_is_myname, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.is_myname(netbios_name) -> bool\n" + "Check whether the specified name matches one of our netbios names.\n" + ""}, { (char *)"LoadParm_use", (PyCFunction) _wrap_LoadParm_use, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"LoadParm_set", (PyCFunction) _wrap_LoadParm_set, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"LoadParm_set", (PyCFunction) _wrap_LoadParm_set, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.set(name, value) -> bool\n" + "Change a parameter.\n" + ""}, { (char *)"LoadParm_get", (PyCFunction) _wrap_LoadParm_get, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_LoadParm", (PyCFunction) _wrap_delete_LoadParm, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"LoadParm_swigregister", LoadParm_swigregister, METH_VARARGS, NULL}, @@ -4187,14 +4205,26 @@ static PyMethodDef SwigMethods[] = { { (char *)"loadparm_service_swigregister", loadparm_service_swigregister, METH_VARARGS, NULL}, { (char *)"new_ParamFile", (PyCFunction)_wrap_new_ParamFile, METH_NOARGS, NULL}, { (char *)"ParamFile_get_section", (PyCFunction) _wrap_ParamFile_get_section, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ParamFile_add_section", (PyCFunction) _wrap_ParamFile_add_section, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"ParamFile_add_section", (PyCFunction) _wrap_ParamFile_add_section, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.add_section(name) -> section\n" + "Add a new section.\n" + ""}, { (char *)"ParamFile_get", (PyCFunction) _wrap_ParamFile_get, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ParamFile_get_string", (PyCFunction) _wrap_ParamFile_get_string, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ParamFile_set_string", (PyCFunction) _wrap_ParamFile_set_string, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ParamFile_set", (PyCFunction) _wrap_ParamFile_set, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ParamFile_first_section", (PyCFunction)_wrap_ParamFile_first_section, METH_O, NULL}, - { (char *)"ParamFile_next_section", (PyCFunction) _wrap_ParamFile_next_section, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ParamFile_read", (PyCFunction) _wrap_ParamFile_read, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"ParamFile_first_section", (PyCFunction)_wrap_ParamFile_first_section, METH_O, (char *)"\n" + "S.first_section() -> section\n" + "Find first section\n" + ""}, + { (char *)"ParamFile_next_section", (PyCFunction) _wrap_ParamFile_next_section, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.next_section(prev) -> section\n" + "Find next section\n" + ""}, + { (char *)"ParamFile_read", (PyCFunction) _wrap_ParamFile_read, METH_VARARGS | METH_KEYWORDS, (char *)"\n" + "S.read(filename) -> bool\n" + "Read a filename.\n" + ""}, { (char *)"ParamFile_write", (PyCFunction) _wrap_ParamFile_write, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_ParamFile", (PyCFunction)_wrap_delete_ParamFile, METH_O, NULL}, { (char *)"ParamFile_swigregister", ParamFile_swigregister, METH_VARARGS, NULL}, |