| Server IP : 107.13.46.68 / Your IP : 216.73.216.232 Web Server : Apache/2.4.58 (Ubuntu) System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/aptkit/ |
Upload File : |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides helper functions for the PackageKit layer
Copyright (C) 2007 Ali Sabil <ali.sabil@gmail.com>
Copyright (C) 2007 Tom Parker <palfrey@tevp.net>
Copyright (C) 2008-2013 Sebastian Heinlein <glatzor@ubuntu.com>
Licensed under the GNU General Public License Version 2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = "Sebastian Heinlein <devel@glatzor.de>"
def bitfield_summarize(*enums):
"""Return the bitfield with the given PackageKit enums."""
field = 0
for enum in enums:
field |= 2 ** int(enum)
return field
def bitfield_add(field, enum):
"""Add a PackageKit enum to a given field"""
field |= 2 ** int(enum)
return field
def bitfield_remove(field, enum):
"""Remove a PackageKit enum to a given field"""
field = field ^ 2 ** int(enum)
return field
def bitfield_contains(field, enum):
"""Return True if a bitfield contains the given PackageKit enum"""
return field & 2 ** int(enum)
# vim: ts=4 et sts=4