github.com/whamcloud/lemur@v0.0.0-20190827193804-4655df8a52af/packaging/ci/lambda/GitPullS3/pygit2/settings.py (about) 1 # -*- coding: utf-8 -*- 2 # 3 # Copyright 2010-2015 The pygit2 contributors 4 # 5 # This file is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License, version 2, 7 # as published by the Free Software Foundation. 8 # 9 # In addition to the permissions in the GNU General Public License, 10 # the authors give you unlimited permission to link the compiled 11 # version of this file into combinations with other programs, 12 # and to distribute those combinations without any restriction 13 # coming from the use of this file. (The General Public License 14 # restrictions do apply in other respects; for example, they cover 15 # modification of the file, and distribution when not linked into 16 # a combined executable.) 17 # 18 # This file is distributed in the hope that it will be useful, but 19 # WITHOUT ANY WARRANTY; without even the implied warranty of 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 # General Public License for more details. 22 # 23 # You should have received a copy of the GNU General Public License 24 # along with this program; see the file COPYING. If not, write to 25 # the Free Software Foundation, 51 Franklin Street, Fifth Floor, 26 # Boston, MA 02110-1301, USA. 27 28 from _pygit2 import option 29 from _pygit2 import GIT_OPT_GET_SEARCH_PATH, GIT_OPT_SET_SEARCH_PATH 30 from _pygit2 import GIT_OPT_GET_MWINDOW_SIZE, GIT_OPT_SET_MWINDOW_SIZE 31 32 33 class SearchPathList(object): 34 35 def __getitem__(self, key): 36 return option(GIT_OPT_GET_SEARCH_PATH, key) 37 38 def __setitem__(self, key, value): 39 option(GIT_OPT_SET_SEARCH_PATH, key, value) 40 41 42 class Settings(object): 43 """Library-wide settings""" 44 45 __slots__ = [] 46 47 _search_path = SearchPathList() 48 49 @property 50 def search_path(self): 51 """Configuration file search path. 52 53 This behaves like an array whose indices correspond to the 54 GIT_CONFIG_LEVEL_* values. The local search path cannot be 55 changed. 56 """ 57 return self._search_path 58 59 @property 60 def mwindow_size(self): 61 """Maximum mmap window size""" 62 return option(GIT_OPT_GET_MWINDOW_SIZE) 63 64 @mwindow_size.setter 65 def mwindow_size(self, value): 66 option(GIT_OPT_SET_MWINDOW_SIZE, value)