diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-02 09:47:48 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-02 09:47:48 +0200 |
commit | 19241f627259fef20231a505230c19e63ae807a0 (patch) | |
tree | a91dba6b4808e754d63b34b12d287ee7e694f7d9 /src/libgamma_error.py | |
parent | misc (diff) | |
download | pylibgamma-19241f627259fef20231a505230c19e63ae807a0.tar.gz pylibgamma-19241f627259fef20231a505230c19e63ae807a0.tar.bz2 pylibgamma-19241f627259fef20231a505230c19e63ae807a0.tar.xz |
fix misc errors + write test
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libgamma_error.py')
-rw-r--r-- | src/libgamma_error.py | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/src/libgamma_error.py b/src/libgamma_error.py index 865d666..0012a21 100644 --- a/src/libgamma_error.py +++ b/src/libgamma_error.py @@ -19,71 +19,65 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. -class LibgammaGroupGid: +class LibgammaGroup: ''' - Data descriptor for accessing the - `libgamma_group_gid` variable. + Class for `group` ''' - def __init__(self): - ''' - Constructor. - ''' - pass - - def __get__(self, obj, obj_type = None) -> int: + @property + def gid(self) -> int: ''' Getter. + + Group that the user needs to be a member of if + `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. ''' from libgamma_native_error import libgamma_native_get_group_gid return libgamma_native_get_group_gid() - def __set__(self, obj, value : int): + @gid.setter + def gid(self, value : int): ''' Setter. + + Group that the user needs to be a member of if + `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. ''' from libgamma_native_error import libgamma_native_set_group_gid - return libgamma_native_set_group_gid(value) - -group_gid = LibgammaGroupGid() -''' -Group that the user needs to be a member of if -`LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. -''' - - -class LibgammaGroupName: - ''' - Data descriptor for accessing the - `libgamma_group_name` variable. - ''' + libgamma_native_set_group_gid(value) - def __init__(self): - ''' - Constructor. - ''' - pass - def __get__(self, obj, obj_type = None) -> str: + @property + def name(self) -> str: ''' Getter. + + Group that the user needs to be a member of if + `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned, + `None` if the name of the group `group.gid` + cannot be determined. ''' from libgamma_native_error import libgamma_native_get_group_name return libgamma_native_get_group_name() - def __set__(self, obj, value : str): + @name.setter + def name(self, value : str): ''' Setter. + + Group that the user needs to be a member of if + `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned, + `None` if the name of the group `group.gid` + cannot be determined. ''' from libgamma_native_error import libgamma_native_set_group_name - return libgamma_native_set_group_name() + libgamma_native_set_group_name(value) -group_name = LibgammaGroupName() + +group = LibgammaGroup() ''' -Group that the user needs to be a member of if -`LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned, -`None` if the name of the group `group_gid` -cannot be determined. + Group that the user needs to be a member of if +`LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned. ''' @@ -262,7 +256,7 @@ Device cannot be access, reason unknown. LIBGAMMA_DEVICE_REQUIRE_GROUP = -22 ''' Device cannot be access, membership of the -`group_gid` (named by `group_name` (can be +`group.gid` (named by `group.name` (can be `None`, if so `errno` may have been set to tell why)) is required. ''' |