How to use aenum - 10 common examples

To help you get started, we’ve selected a few aenum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ManageIQ / integration_tests / cfme / fixtures / templates.py View on Github external
from collections.abc import Mapping

import pytest
from aenum import NamedConstant

from cfme.fixtures.templateloader import TEMPLATES
from cfme.utils.log import logger


# TODO restructure these to indirectly parametrize the name, and provide name constants here
# These are getting improperly imported and used as functions

class Templates(NamedConstant):
    DPORTGROUP_TEMPLATE = "dportgroup_template"
    DPORTGROUP_TEMPLATE_MODSCOPE = "dportgroup_template_modscope"
    DUAL_DISK_TEMPLATE = "dual_disk_template"
    DUAL_NETWORK_TEMPLATE = "dual_network_template"
    RHEL69_TEMPLATE = "rhel69_template"
    RHEL7_MINIMAL = "rhel7_minimal"
    RHEL7_MINIMAL_MODSCOPE = "rhel7_minimal_modscope"
    UBUNTU16_TEMPLATE = "ubuntu16_template"
    WIN7_TEMPLATE = "win7_template"
    WIN10_TEMPLATE = "win10_template"
    WIN2016_TEMPLATE = "win2016_template"
    WIN2012_TEMPLATE = "win2012_template"


@pytest.fixture(scope="function")
def template(template_location, provider):
github radiasoft / sirepo / sirepo / api_perm.py View on Github external
u"""decorators for API permissions and the permissions themselves

:copyright: Copyright (c) 2018 RadiaSoft LLC.  All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern.pkdebug import pkdc, pkdexc, pkdlog, pkdp
from pykern import pkinspect
import aenum


#: decorator sets this attribute with an APIPerm
ATTR = 'api_perm'


class APIPerm(aenum.Flag):
    #: A user is required but there might not be a cookie yet
    ALLOW_COOKIELESS_REQUIRE_USER = aenum.auto()
    #: cookie.set_user can be called even if a cookie wasn't received
    ALLOW_COOKIELESS_SET_USER = aenum.auto()
    #: anybody can view this page, even without cookies
    ALLOW_VISITOR = aenum.auto()
    #: use basic auth authentication (only)
    REQUIRE_AUTH_BASIC = aenum.auto()
    #: a cookie has to have been returned, which might contain a user
    REQUIRE_COOKIE_SENTINEL = aenum.auto()
    #: a user will be created if necessary and auth may be necessary
    REQUIRE_USER = aenum.auto()


def _init():
    def _new(e):

aenum

Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants

BSD-2-Clause
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis