From 6bdb0135924fe8370f5382b3d01648b5b265ee90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 23 Mar 2014 21:21:01 +0100 Subject: [PATCH 1/2] settings: python 3.3 compat Python 3.3 doesn't like us overriding properties in __slots__, so set it to an empty list. --- pygit2/settings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pygit2/settings.py b/pygit2/settings.py index d6e41998c..6455de17e 100644 --- a/pygit2/settings.py +++ b/pygit2/settings.py @@ -39,9 +39,13 @@ def __setitem__(self, key, value): class Settings(object): - __slots__ = ['mwindow_size', 'search_path'] + __slots__ = [] - search_path = SearchPathList() + _search_path = SearchPathList() + + @property + def search_path(self): + return self._search_path @property def mwindow_size(self): From 87c8aef7d999ac52302c76373a66317f1e194803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 23 Mar 2014 21:33:10 +0100 Subject: [PATCH 2/2] Settings: add documentation The search_path attribute is now inside __init__() so it shows properly in the generated documentation. --- docs/index.rst | 1 + docs/settings.rst | 8 ++++++++ pygit2/settings.py | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100644 docs/settings.rst diff --git a/docs/index.rst b/docs/index.rst index f838b3518..6eccbd564 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -45,6 +45,7 @@ Usage guide: config remotes blame + settings Indices and tables diff --git a/docs/settings.rst b/docs/settings.rst new file mode 100644 index 000000000..f1d7a9871 --- /dev/null +++ b/docs/settings.rst @@ -0,0 +1,8 @@ +********************************************************************** +Settings +********************************************************************** + +.. contents:: + +.. autoclass:: pygit2.Settings + :members: diff --git a/pygit2/settings.py b/pygit2/settings.py index 6455de17e..b5805637b 100644 --- a/pygit2/settings.py +++ b/pygit2/settings.py @@ -38,6 +38,7 @@ def __setitem__(self, key, value): option(GIT_OPT_SET_SEARCH_PATH, key, value) class Settings(object): + """Library-wide settings""" __slots__ = [] @@ -45,10 +46,17 @@ class Settings(object): @property def search_path(self): + """Configuration file search path. + + This behaves like an array whose indices correspond to the + GIT_CONFIG_LEVEL_* values. The local search path cannot be + changed. + """ return self._search_path @property def mwindow_size(self): + """Maximum mmap window size""" return option(GIT_OPT_GET_MWINDOW_SIZE) @mwindow_size.setter